# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
569515 | 2022-05-27T12:52:27 Z | NemanjaSo2005 | 늑대인간 (IOI18_werewolf) | C++14 | 4000 ms | 41308 KB |
#include "werewolf.h" #include<bits/stdc++.h> #define ll long long using namespace std; ll N,M,Q,prosli[200005],pos[200005],pvred; vector<int> graf[200005],ret; struct kveri{ int poc,kraj,id; ll L,R; } upiti[200005]; void dfs(int gde,int L,int R){ // cout<<"DFS sa "<<pvred<<" u "<<gde<<endl; prosli[gde]=pvred; pos[gde]++; for(int i=0;i<graf[gde].size();i++){ if(prosli[graf[gde][i]]==pvred) continue; //cout<<graf[gde][i]<<" "<<L<<" "<<R<<endl; if(graf[gde][i]<L) continue; if(graf[gde][i]>R) continue; // cout<<"DALJE"<<endl; dfs(graf[gde][i],L,R); } } vector<int> check_validity(int NN, vector<int> X, vector<int> Y,vector<int> S, vector<int> E,vector<int> L, vector<int> R) { N=NN; M=X.size(); Q=L.size(); ret.resize(Q); for(int i=0;i<M;i++){ X[i]++; Y[i]++; graf[X[i]].push_back(Y[i]); graf[Y[i]].push_back(X[i]); } for(int i=0;i<Q;i++){ S[i]++; E[i]++; L[i]++; R[i]++; upiti[i+1].id=i; upiti[i+1].poc=S[i]; upiti[i+1].kraj=E[i]; upiti[i+1].L=L[i]; upiti[i+1].R=R[i]; } if(N*Q<=10000000){ for(int j=1;j<=Q;j++){ for(int i=1;i<=N;i++) pos[i]=0; pvred++; dfs(upiti[j].poc,upiti[j].L,N); // for(int i=1;i<=N;i++) // cout<<pos[i]<<" "; //cout<<endl; pvred++; dfs(upiti[j].kraj,1,upiti[j].R); //for(int i=1;i<=N;i++) // cout<<pos[i]<<" "; //cout<<endl; ret[upiti[j].id]=0; for(int i=1;i<=N;i++) if(pos[i]==2) ret[upiti[j].id]=1; } return ret; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4948 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 3 ms | 4948 KB | Output is correct |
4 | Correct | 3 ms | 5016 KB | Output is correct |
5 | Correct | 3 ms | 5012 KB | Output is correct |
6 | Correct | 4 ms | 5012 KB | Output is correct |
7 | Correct | 3 ms | 4948 KB | Output is correct |
8 | Correct | 3 ms | 4948 KB | Output is correct |
9 | Correct | 4 ms | 5016 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4948 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 3 ms | 4948 KB | Output is correct |
4 | Correct | 3 ms | 5016 KB | Output is correct |
5 | Correct | 3 ms | 5012 KB | Output is correct |
6 | Correct | 4 ms | 5012 KB | Output is correct |
7 | Correct | 3 ms | 4948 KB | Output is correct |
8 | Correct | 3 ms | 4948 KB | Output is correct |
9 | Correct | 4 ms | 5016 KB | Output is correct |
10 | Correct | 300 ms | 5536 KB | Output is correct |
11 | Correct | 169 ms | 5412 KB | Output is correct |
12 | Correct | 28 ms | 5688 KB | Output is correct |
13 | Correct | 354 ms | 5540 KB | Output is correct |
14 | Correct | 215 ms | 5488 KB | Output is correct |
15 | Correct | 282 ms | 5676 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4035 ms | 41308 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4948 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 3 ms | 4948 KB | Output is correct |
4 | Correct | 3 ms | 5016 KB | Output is correct |
5 | Correct | 3 ms | 5012 KB | Output is correct |
6 | Correct | 4 ms | 5012 KB | Output is correct |
7 | Correct | 3 ms | 4948 KB | Output is correct |
8 | Correct | 3 ms | 4948 KB | Output is correct |
9 | Correct | 4 ms | 5016 KB | Output is correct |
10 | Correct | 300 ms | 5536 KB | Output is correct |
11 | Correct | 169 ms | 5412 KB | Output is correct |
12 | Correct | 28 ms | 5688 KB | Output is correct |
13 | Correct | 354 ms | 5540 KB | Output is correct |
14 | Correct | 215 ms | 5488 KB | Output is correct |
15 | Correct | 282 ms | 5676 KB | Output is correct |
16 | Execution timed out | 4035 ms | 41308 KB | Time limit exceeded |
17 | Halted | 0 ms | 0 KB | - |