Submission #862170

# Submission time Handle Problem Language Result Execution time Memory
862170 2023-10-17T15:29:35 Z Rifal Zagonetka (COI18_zagonetka) C++14
0 / 100
186 ms 424 KB
#include <bits/stdc++.h>
#include <fstream>
///#define endl '\n'
#define mod 998244353
#define INF 900000000
//#define cin fin
//#define cout fout
//#define fi first
//#define se second
using namespace std;
//ofstream fout("intel.out");
//ifstream fin("intel.in");

int main()
{
    ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    int n; cin >> n; int arr[n]; int ans1[n+1], ans2[n+1], ans3[n+1];
    for(int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    cout << "query" << ' ' << endl;
    for(int i = 1; i <= n; i++) {
        ans1[i] = i; cout << i << ' ' << endl;
    }
    cout << endl;
    int x; cin >> x;
    if(x == 0) {
        
        for(int i = n; i > 1; i--) {
            int cnt = 1; bool ok = false;
            for(int j = i-1; j >= 1; j--) {
                cnt = 1;
                ans1[j] = j+1; ans1[i] = j;
                for(int z = 1; z <= n; z++) {
                    if(z == i || z == j) {
                       if(z == j) cnt += 2;
                        continue;
                    }
                    ans1[z] = cnt;  cnt++;
                }
                cout << "query" << ' ' << endl;
                for(int z = 1; z <= n; z++) cout << ans1[z] << ' ' << endl;
                cout << endl; cin >> x;
                if(x == 1) {
                    ok = true; break;
                }
            }
            if(ok) break;
        }
    }
    cout << "query" << ' ' << endl;
    for(int i = n; i >= 1; i--) {
        ans2[(n-i)+1] = i; cout << i << ' ' << endl;
        
    }
    cout << endl; cin >> x; 
    if(x == 0) {
        for(int i = 1; i < n; i++) {
            int cnt = n; bool ok = false;
            for(int j = i+1; j <= n; j++) {
                cnt = n;
                ans2[i] = n-i; ans2[j] = (n-i)+1;
                for(int z = 1; z <= n; z++) {
                    if(z == i || z == j) {
                       if(z== i) cnt -= 2; 
                       continue;
                    }
                    ans2[z] = cnt; cnt--;
                }
                cout << "query" << ' ' << endl;
                for(int z = 1; z <= n; z++) cout << ans2[z] << ' ' << endl;
                cout << endl; cin >> x;
                if(x == 1) {
                    ok = true; break;
                }
                 
            }
            if(ok) break;
        }
    }
    cout << "end" << endl;
    for(int i = 1; i <= n; i++) cout << ans1[i] << ' ' << endl;
    cout << endl;
    for(int i = 1; i <= n; i++) cout << ans2[i] << ' ' << endl;
    cout << endl;
 return 0;
}

Compilation message

zagonetka.cpp: In function 'int main()':
zagonetka.cpp:17:60: warning: unused variable 'ans3' [-Wunused-variable]
   17 |     int n; cin >> n; int arr[n]; int ans1[n+1], ans2[n+1], ans3[n+1];
      |                                                            ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 186 ms 424 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -