Submission #726885

# Submission time Handle Problem Language Result Execution time Memory
726885 2023-04-19T13:41:25 Z kerem Slagalica (COCI19_slagalica2) C++14
0 / 70
58 ms 332 KB
#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

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 time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 52 ms 332 KB Output is correct
2 Incorrect 58 ms 276 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 47 ms 212 KB Output is correct
2 Incorrect 54 ms 276 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 47 ms 212 KB Output is correct
2 Incorrect 46 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 288 KB Output isn't correct
2 Halted 0 ms 0 KB -