标签:
#include<stdio.h> #include<string.h> #include<algorithm> #include<iostream> #include<vector> using namespace std; const int maxn = 101000; int isprison[maxn], noprison[maxn]; int possible[maxn]; int a[maxn]; int main(){ int T,n,m; scanf("%d",&T); while(T--){ memset(isprison,0,sizeof(isprison)); memset(noprison,0,sizeof(noprison)); memset(possible,0,sizeof(possible)); scanf("%d%d",&n,&m); int issum = 0, nosum = 0; for(int i = 1; i <= n; i++){ scanf("%d",&a[i]); if(a[i]>0){ isprison[a[i]]++; issum++; }else{ noprison[-a[i]]++; nosum++; } } int k = 0; for(int i = 1; i <= n; i++){ if(m == nosum - noprison[i] + isprison[i]){ possible[i] = 1; k++; } } if(k > 1){ for(int i = 1; i <= n; i++){ if(a[i] > 0){ if(possible[a[i]]){ puts("Not defined"); }else { puts("Lie"); } }else { if(possible[-a[i]]){ puts("Not defined"); }else{ puts("Truth"); } } } }else{ for(int i = 1; i <= n; i++){ if(a[i] > 0){ if(possible[a[i]]){ puts("Truth"); }else { puts("Lie"); } }else { if(possible[-a[i]]){ puts("Lie"); }else{ puts("Truth"); } } } } } return 0; } /* 55 4 1 +2 -3 +4 -1 */
标签:
原文地址:http://www.cnblogs.com/chengsheng/p/4947126.html