# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
119397 |
2019-06-21T07:27:48 Z |
임유진(#2921) |
Werewolf (IOI18_werewolf) |
C++14 |
|
4000 ms |
33904 KB |
#include "werewolf.h"
#include<vector>
#include<algorithm>
using namespace std;
#define MAXN 200005
vector<int> e[MAXN];
bool chk[2][MAXN];
void dfs(int x, int c, int l, int r){
chk[c][x]=true;
for(auto a:e[x]) if(!chk[c][a]&&l<=a&&a<=r) dfs(a, c, l, r);
}
vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) {
int M=X.size(), Q=S.size();
vector<int> A(Q);
for(int i=0; i<M; i++){
e[X[i]].push_back(Y[i]);
e[Y[i]].push_back(X[i]);
}
for(int i=0; i<Q; i++){
for(int i=0; i<N; i++) chk[0][i]=chk[1][i]=false;
dfs(S[i], 0, L[i], N);
dfs(E[i], 1, 0, R[i]);
A[i]=0;
if(S[i]>=L[i]&&E[i]<=R[i]) for(int j=L[i]; j<=R[i]; j++) if(chk[0][j]&&chk[1][j]) A[i]=1;
}
return A;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
4992 KB |
Output is correct |
2 |
Correct |
7 ms |
4992 KB |
Output is correct |
3 |
Correct |
6 ms |
4992 KB |
Output is correct |
4 |
Correct |
6 ms |
4992 KB |
Output is correct |
5 |
Correct |
7 ms |
4992 KB |
Output is correct |
6 |
Correct |
6 ms |
4992 KB |
Output is correct |
7 |
Correct |
5 ms |
4992 KB |
Output is correct |
8 |
Correct |
5 ms |
4992 KB |
Output is correct |
9 |
Correct |
5 ms |
4992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
4992 KB |
Output is correct |
2 |
Correct |
7 ms |
4992 KB |
Output is correct |
3 |
Correct |
6 ms |
4992 KB |
Output is correct |
4 |
Correct |
6 ms |
4992 KB |
Output is correct |
5 |
Correct |
7 ms |
4992 KB |
Output is correct |
6 |
Correct |
6 ms |
4992 KB |
Output is correct |
7 |
Correct |
5 ms |
4992 KB |
Output is correct |
8 |
Correct |
5 ms |
4992 KB |
Output is correct |
9 |
Correct |
5 ms |
4992 KB |
Output is correct |
10 |
Correct |
258 ms |
5560 KB |
Output is correct |
11 |
Correct |
137 ms |
5376 KB |
Output is correct |
12 |
Correct |
28 ms |
5568 KB |
Output is correct |
13 |
Correct |
280 ms |
5440 KB |
Output is correct |
14 |
Correct |
178 ms |
5396 KB |
Output is correct |
15 |
Correct |
258 ms |
5624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4025 ms |
33904 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
4992 KB |
Output is correct |
2 |
Correct |
7 ms |
4992 KB |
Output is correct |
3 |
Correct |
6 ms |
4992 KB |
Output is correct |
4 |
Correct |
6 ms |
4992 KB |
Output is correct |
5 |
Correct |
7 ms |
4992 KB |
Output is correct |
6 |
Correct |
6 ms |
4992 KB |
Output is correct |
7 |
Correct |
5 ms |
4992 KB |
Output is correct |
8 |
Correct |
5 ms |
4992 KB |
Output is correct |
9 |
Correct |
5 ms |
4992 KB |
Output is correct |
10 |
Correct |
258 ms |
5560 KB |
Output is correct |
11 |
Correct |
137 ms |
5376 KB |
Output is correct |
12 |
Correct |
28 ms |
5568 KB |
Output is correct |
13 |
Correct |
280 ms |
5440 KB |
Output is correct |
14 |
Correct |
178 ms |
5396 KB |
Output is correct |
15 |
Correct |
258 ms |
5624 KB |
Output is correct |
16 |
Execution timed out |
4025 ms |
33904 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |