Submission #726890

#TimeUsernameProblemLanguageResultExecution timeMemory
726890keremSlagalica (COCI19_slagalica2)C++14
5 / 70
67 ms340 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define fir first #define sec second #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int32_t main(){ int n,k=0,l,r,a,b,c,d,i,j,sayac=1; cin >> n; for(int ind=0;ind<n;ind++){ int x,y; cin >> x >> y; if(x==5) l=1,a=y,k++; else if(x==6) l=0,a=y,k--; else if(x==7) r=1,d=y,k++; else if(x==8) r=0,d=y,k--; else if(sayac==1) i=x,b=y,sayac++; else j=x,c=y; if(x==1) k+=2; if(x==4) k-=2; } if(k!=0){ cout << -1; return 0; } cout << a << " "; if(n==3){ if(i==2 and l==1){ cout << -1; return 0; } if(i==3 and l==0){ cout << -1; return 0; } cout << b << " "; } if(n==4){ if(i>j) {int temp=i;i=j;j=temp;temp=b;b=c;c=temp;} if(i==1 and j==2) cout << c << " " << b << " "; if(i==1 and j==3) cout << b << " " << c << " "; if(i==1 and j==4){ if(l==0) cout << b << " " << c << " "; else cout << c << " " << b << " "; } if(i==2 and j==2){ if(l==1){ cout << -1; return 0; } cout << min(c,b) << " " << max(c,b) << " "; } if(i==2 and j==4) cout << c << " " << b << " "; if(i==3 and j==3){ if(l==0){ cout << -1; return 0; } cout << min(c,b) << " " << max(c,b) << " "; } if(i==3 and j==4) cout << b << " " << c << " "; } cout << d; return 0; }

Compilation message (stderr)

slagalica.cpp: In function 'int32_t main()':
slagalica.cpp:9:17: warning: variable 'r' set but not used [-Wunused-but-set-variable]
    9 |     int n,k=0,l,r,a,b,c,d,i,j,sayac=1;
      |                 ^
slagalica.cpp:30:22: warning: 'l' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |         if(i==2 and l==1){
      |                     ~^~~
slagalica.cpp:41:9: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
   41 |         if(i>j) {int temp=i;i=j;j=temp;temp=b;b=c;c=temp;}
      |         ^~
slagalica.cpp:30:13: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |         if(i==2 and l==1){
      |            ~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...