Submission #167381

#TimeUsernameProblemLanguageResultExecution timeMemory
167381ahmetIzlet (COI19_izlet)C++14
25 / 100
818 ms52984 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i,n) for(long long (i)=0;(i)<(n);++(i)) #define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i)) #define endl '\n' #define st first #define nd second #define pb push_back #define mp make_pair const int mx=3005; int ss,n,c[mx][mx]; vector <pair <int,int> > vans; int ans[mx]; int main(){ /*freopen(".in", "r", stdin); freopen(".out", "w", stdout); */ios_base::sync_with_stdio(false);cin.tie(NULL); cin >> ss >> n; ref(i,1,n){ ans[i]=-1; ref(j,1,n){ cin >> c[i][j]; } } ans[1]=1; set <int> s; //*--a.end() *a.rbegin() int sn=1; for(int i=2;i<=n;++i){ if(c[i][i-1]==1){ ans[i]=ans[i-1]; } else if(c[1][i-1]!=c[1][i]){ ans[i]=sn+1; ++sn; } else if(i>2){ int flag=0; for(int j=i-2;j>0;--j){ //cout << "MAK"; if(c[j][i-1]==c[j][i]){ ans[i]=ans[j]; break; } } } s.insert(ans[i]); } for(int i=1;i<=n;++i) cout << ans[i] << " "; cout << endl; for(int i=1;i<n;++i) cout << i << " "<< i+1 << endl; }

Compilation message (stderr)

izlet.cpp: In function 'int main()':
izlet.cpp:39:8: warning: unused variable 'flag' [-Wunused-variable]
    int flag=0;
        ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...