Submission #150963

#TimeUsernameProblemLanguageResultExecution timeMemory
150963JovanK26Izlet (COI19_izlet)C++14
25 / 100
847 ms74044 KiB
#include <bits/stdc++.h> using namespace std; int n; int mat[3001][3001]; int color[3001]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int sub; cin >> sub; if(sub==2) { cin >> n; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { cin >> mat[i][j]; } } int clr=1; color[0]=1; for(int i=1;i<n;i++) { bool chk=0; for(int j=i-1;j>=0;j--) { if(mat[i][j]==mat[i-1][j]) { chk=1; color[i]=color[j]; break; } } if(!chk) { color[i]=++clr; } } for(int i=0;i<n;i++) { cout << color[i]<<' '; } cout <<'\n'; for(int i=0;i<n-1;i++) { cout << i+1<<' '<<i+2<<'\n'; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...