# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
115169 | 2019-06-05T15:37:51 Z | tinjyu | 늑대인간 (IOI18_werewolf) | C++14 | 4000 ms | 34056 KB |
#include "werewolf.h" #include <iostream> using namespace std; long long int t[400005][3],road[200005],map[400005][2],tag[200005][2]; std::vector<int> check_validity(int n, std::vector<int> x, std::vector<int> y,std::vector<int> s, std::vector<int> e,std::vector<int> l, std::vector<int> r) { int q = s.size(); int m = x.size(); std::vector<int> a(q); for(int i=0;i<n;i++)road[i]=-1; for(int i=0;i<m;i++) { map[i*2][0]=x[i]; map[i*2][1]=road[y[i]]; road[y[i]]=i*2; map[i*2+1][0]=y[i]; map[i*2+1][1]=road[x[i]]; road[x[i]]=i*2+1; } int ans; for(int i=0;i<q;i++) { ans=0; for(int j=0;j<n;j++) { tag[j][0]=0; tag[j][1]=0; } int people=l[i],wolf=r[i],start=s[i],end=e[i]; cout<<start<<" "<<end<<endl; tag[start][0]=1; t[1][0]=start; t[1][1]=0; t[1][2]=-1; int p=1,pp=1; while(p<=pp) { int now=t[p][0],mode=t[p][1]; int g=road[now]; if(now<wolf && now>=people) { if(t[p][1]==0 && tag[now][1]==0) { pp++; t[pp][0]=now; t[pp][1]=1; t[pp][2]=p; //cout<<now<<" 1 "; tag[now][1]=1; } else if(tag[now][0]==0) { pp++; t[pp][0]=now; t[pp][1]=0; t[pp][2]=p; //cout<<now<<" 0 "; tag[now][0]=1; } } while(g!=-1) { if(tag[map[g][0]][mode]==0 && ((mode==0 && map[g][0]>=people) || (mode==1 && map[g][0]<wolf))) { pp++; t[pp][0]=map[g][0]; t[pp][1]=mode; t[pp][2]=p; //cout<<map[g][0]<<" "<<mode<<" "; tag[map[g][0]][mode]=1; } g=map[g][1]; } //cout<<endl; p++; } //cout<<end<<endl; a[i]=tag[end][1]; } return a; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4005 ms | 34056 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |