# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167272 | 2019-12-07T07:07:52 Z | theStaticMind | Izlet (COI19_izlet) | C++14 | 1047 ms | 109704 KB |
#include<bits/stdc++.h> #define mp make_pair #define pb push_back #define ii pair<int,int> #define all(x) (x).begin(),(x).end() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("q.gir","r",stdin); // freopen("q.cik","w",stdout); int k; cin>>k; if(k==2){ int n; cin>>n; vector<vector<int>>adj(n,vector<int>(n)); for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>adj[i][j]; } } vector<int>color(n,-1); color[0]=1; for(int i=1;i<n;i++){ if(adj[0][i]!=adj[0][i-1])color[i]=adj[0][i]; } for(int i=0;i<n;i++){ if(color[i]>0)continue; set<int>vis; for(int j=i-1;j>=0;j--){ if(!vis.count(color[j])&&adj[i][j]==adj[i][j+1]){ color[i]=color[j]; break; } vis.insert(color[j]); } if(color[i]==-1)color[i]=1; } for(int i=0;i<n;i++)cout<<color[i]<<" ";cout<<"\n"; for(int i=1;i<=n-1;i++)cout<<i<<" "<<i+1<<"\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 675 ms | 71416 KB | Output is correct |
2 | Correct | 853 ms | 88600 KB | Output is correct |
3 | Correct | 1047 ms | 108808 KB | Output is correct |
4 | Correct | 904 ms | 109704 KB | Output is correct |
5 | Correct | 755 ms | 88788 KB | Output is correct |
6 | Correct | 733 ms | 95344 KB | Output is correct |
7 | Correct | 545 ms | 69624 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |