제출 #732965

#제출 시각아이디문제언어결과실행 시간메모리
732965n0sk1ll경찰관과 강도 (BOI14_coprobber)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0) #define mp make_pair #define xx first #define yy second #define pb push_back #define pf push_front #define popb pop_back #define popf pop_front #define all(x) x.begin(),x.end() #define ff(i,a,b) for (int i = a; i < b; i++) #define fff(i,a,b) for (int i = a; i <= b; i++) #define bff(i,a,b) for (int i = b-1; i >= a; i--) #define bfff(i,a,b) for (int i = b; i >= a; i--) using namespace std; long double typedef ld; unsigned int typedef ui; long long int typedef li; pair<int,int> typedef pii; pair<li,li> typedef pli; pair<ld,ld> typedef pld; vector<vector<int>> typedef graph; unsigned long long int typedef ull; //const int mod = 998244353; const int mod = 1000000007; //Note to self: Check for overflow int dje[503][503]; //ako policajac na potezu pobedjuje, gde treba ici? int zauz[503][503][2]; //<0 ako smo vec izracunali xd bool dp[503][503][2]; //canwin //0 - pandur na potezu //1 - crook na potezu graph g(505); int P; int start(int n, bool A[500][500]) { ff(i,0,n) ff(j,i+1,n) if (A[i][j]) g[i].pb(j),g[j].pb(i); queue<pair<pii,pii>> bfs; ff(i,0,n) bfs.push({{i,i},{0,-1}}),bfs.push({{i,i},{1,-1}}); //ovo vazi samo kad je lopov na potezu ff(i,0,n) ff(j,0,n) zauz[i][j][1]+=(int)g[j].size(); ff(i,0,n) ff(j,0,n) zauz[i][j][0]=mod; while (!bfs.empty()) { int p=bfs.front().xx.xx; int l=bfs.front().xx.yy; bool ko=bfs.front().yy.xx; int okle=bfs.front().yy.yy; bfs.pop(); if (zauz[p][l][ko]<0) continue; zauz[p][l][ko]=-1; dp[p][l][ko]=true; if (ko==0) dje[p][l]=okle; if (ko) //crook na trenutnom potezu { //znaci policajac je bio na proslom bfs.push({{p,l},{0,p}}); for (auto pugde : g[p]) bfs.push({{pugde,l},{0,p}}); } else //policajac na potezu { //znaci crook je bio na proslom for (auto lugde : g[l]) { zauz[p][lugde][1]--; if (zauz[p][lugde][1]==0) bfs.push({{p,lugde},{1,-1}}); } } } /*cout<<"policajac:"<<endl; ff(i,0,n) { ff(j,0,n) cout<<dp[i][j][0]<<" "; cout<<endl; } cout<<endl; cout<<"lopov:"<<endl; ff(i,0,n) { ff(j,0,n) cout<<dp[i][j][1]<<" "; cout<<endl; } cout<<endl; cout<<"jebem ti kurac:"<<endl; ff(i,0,n) { ff(j,0,n) cout<<dje[i][j]<<" "; cout<<endl; } cout<<endl; cout<<endl;*/ ff(i,0,n) { bool moze=true; ff(j,0,n) if (!dp[i][j][0]) moze=false; if (moze) return P=i,i; } return -1; } int nextMove(int R) { return P=dje[P][R],P; } /// don't modify the main function int main() { #define MAX_N 500 int N; cin >> N; bool A[MAX_N][MAX_N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { cin >> A[i][j]; } } int P = start(N,A); cout << P << endl; int R; cin >> R; while (true) { if (P == R) break; P = nextMove(R); cout << P << endl; if (P == R) break; cin >> R; } } //Note to self: Check for overflow

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccmCl2F2.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccx9yfl3.o:coprobber.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status