Submission #34267

# Submission time Handle Problem Language Result Execution time Memory
34267 2017-11-09T00:06:07 Z imaxblue Cop and Robber (BOI14_coprobber) C++14
60 / 100
965 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()

int n, m, a, b, p, dp[505][505][2], nxt[505][505], in[505][505];
bool u[505][505][2], t;
vector<int> v[505];
queue<pair<pii, pii> > q;
#define top front
int start (int N, bool A[][500]){
	fox(l, N){
      fox(l2, N){
        if (A[l][l2]) {
            v[l].pb(l2);
            fox(l3, N){
                in[l3][l2]++;
            }
        }
      }
	}
	fox(l, N){
        q.push(mp(mp(l, l), mp(0, -1)));
        q.push(mp(mp(l, l), mp(1, -1)));
	}
	while(!q.empty()){
        a=q.top().x.x; b=q.top().x.y; t=q.top().y.x; p=q.top().y.y; q.pop();
        if (u[a][b][t]) continue;
        if (t) nxt[a][b]=p;
        u[a][b][t]=1;
        //cout << a << ' ' << b << ' ' << t<< endl;
        if (t){
            fox(l, v[b].size()){
                in[a][v[b][l]]--;
                if (in[a][v[b][l]]==0){
                    q.push(mp(mp(a, v[b][l]), mp(!t, b)));
                }
            }
        } else {
            fox(l, v[a].size()){
                q.push(mp(mp(v[a][l], b), mp(!t, a)));
            }
            q.push(mp(mp(a, b), mp(!t, a)));
        }
	}
	fox(l, N){
		bool f=1;
		fox(l2, N){
			if (u[l][l2][1]==0){
				f=0;
				break;
			}
		}
		if (f){
			return l;
		}
	}
	return -1;
}
int nextMove(int R){
	m=R;
	if (n==m) return n;
	n=nxt[n][m];
	return n;
}
/*int main(){
	int n;
	bool a[500][500];
	cin >> n;
	fox(l, n) fox(l2, n) cin >> a[l][l2];
	//fox(l, n) fox(l2, n) cout << dp[l][l2][0];
	cout << start(n, a);
}*/

Compilation message

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
coprobber.cpp:54:17:
             fox(l, v[b].size()){
                 ~~~~~~~~~~~~~~    
coprobber.cpp:54:13: note: in expansion of macro 'fox'
             fox(l, v[b].size()){
             ^~~
coprobber.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
coprobber.cpp:61:17:
             fox(l, v[a].size()){
                 ~~~~~~~~~~~~~~    
coprobber.cpp:61:13: note: in expansion of macro 'fox'
             fox(l, v[a].size()){
             ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 62 ms 4344 KB Output is correct
5 Correct 18 ms 2432 KB Output is correct
6 Correct 74 ms 5336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 75 ms 5244 KB Output is correct
4 Correct 64 ms 4344 KB Output is correct
5 Correct 72 ms 5416 KB Output is correct
6 Correct 123 ms 4472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 4 ms 896 KB Output is correct
11 Correct 4 ms 1024 KB Output is correct
12 Correct 2 ms 512 KB Output is correct
13 Correct 3 ms 768 KB Output is correct
14 Correct 5 ms 1152 KB Output is correct
15 Correct 3 ms 896 KB Output is correct
16 Correct 3 ms 1152 KB Output is correct
17 Correct 17 ms 6672 KB Output is correct
18 Correct 3 ms 896 KB Output is correct
19 Correct 2 ms 432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 61 ms 4344 KB Output is correct
5 Correct 19 ms 2548 KB Output is correct
6 Correct 72 ms 5364 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 73 ms 5372 KB Output is correct
10 Correct 65 ms 4412 KB Output is correct
11 Correct 70 ms 5536 KB Output is correct
12 Correct 68 ms 4344 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 512 KB Output is correct
17 Correct 4 ms 896 KB Output is correct
18 Correct 4 ms 1024 KB Output is correct
19 Correct 2 ms 512 KB Output is correct
20 Correct 3 ms 768 KB Output is correct
21 Correct 5 ms 1152 KB Output is correct
22 Correct 3 ms 896 KB Output is correct
23 Correct 4 ms 1280 KB Output is correct
24 Correct 17 ms 6672 KB Output is correct
25 Correct 3 ms 896 KB Output is correct
26 Correct 6 ms 1536 KB Output is correct
27 Correct 17 ms 2552 KB Output is correct
28 Correct 30 ms 3192 KB Output is correct
29 Runtime error 965 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
30 Halted 0 ms 0 KB -