# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
34938 |
2017-11-17T08:29:58 Z |
wan2000 |
스파이 (JOI13_spy) |
C++14 |
|
49 ms |
75736 KB |
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline void read(T &x){
x = 0; char ch;
while(!isdigit(ch=getchar()));
do{x=10*x+ch-'0';}while(isdigit(ch=getchar()));
}
const int N = 2001;
const int M = 1e5+1;
int n, m, mx;
bitset<M> D[2][N], F[N];
vector<int> Adj[2][N];
void DFS(int u, int tp){
F[u] &= D[tp][u];
for(int i = 0; i < (int)Adj[tp][u].size(); i++){
int v = Adj[tp][u][i];
D[tp][v] |= D[tp][u];
DFS(v,tp);
}
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
read(n); read(m);
for(int i = 1; i <= n; i++){
int x, y;
read(x); read(y);
Adj[0][x].push_back(i);
Adj[1][y].push_back(i);
}
for(int i = 1; i <= m; i++){
int x, y;
read(x); read(y);
D[0][x].set(i);
D[1][y].set(i);
}
mx = m/64+1;
for(int i = 1; i <= n; i++){
F[i].flip();
}
DFS(0,0);
DFS(0,1);
for(int i = 1; i <= n; i++){
cout<<F[i].count()<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
75572 KB |
Output is correct |
2 |
Correct |
0 ms |
75572 KB |
Output is correct |
3 |
Correct |
6 ms |
75572 KB |
Output is correct |
4 |
Correct |
6 ms |
75572 KB |
Output is correct |
5 |
Correct |
3 ms |
75572 KB |
Output is correct |
6 |
Correct |
3 ms |
75572 KB |
Output is correct |
7 |
Correct |
6 ms |
75572 KB |
Output is correct |
8 |
Correct |
0 ms |
75572 KB |
Output is correct |
9 |
Correct |
0 ms |
75572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
75736 KB |
Output is correct |
2 |
Runtime error |
46 ms |
75732 KB |
Execution killed because of forbidden syscall writev (20) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
29 ms |
75704 KB |
Execution killed because of forbidden syscall gettid (186) |
2 |
Halted |
0 ms |
0 KB |
- |