Submission #1259953

#TimeUsernameProblemLanguageResultExecution timeMemory
1259953inkvizytorWorm Worries (BOI18_worm)C++20
0 / 100
344 ms436 KiB
#include<bits/stdc++.h>
using namespace std;

#define ll long long


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m, k, q;
    cin >> n >> m >> k >> q;
    srand(2137);
    int maks = 0;
    vector<int> p = {0, 0, 0};
    for (int i = 0; i < q/2; i++) {
        int x = rand()%n+1, y = rand()%m+1, z = rand()%k+1;
        cout << "? " << x << ' ' << y << ' ' << z << endl;
        int l;
        cin >> l;
        if (l > maks) {
            maks = l;
            p = {x, y, z};
        }
    }
    while (true) {
        if (p[0]>1) {
            cout << "? " << p[0]-1 << ' ' << p[1] << ' ' << p[2] << endl;
            int l;
            cin >> l;
            if (l > maks) {
                p[0]--;
                l = maks;
            }
        }
        if (p[0]<n) {
            cout << "? " << p[0]+1 << ' ' << p[1] << ' ' << p[2] << endl;
            int l;
            cin >> l;
            if (l > maks) {
                p[0]++;
                l = maks;
            }
        }
        if (p[1]>1) {
            cout << "? " << p[0] << ' ' << p[1]-1 << ' ' << p[2] << endl;
            int l;
            cin >> l;
            if (l > maks) {
                p[1]--;
                l = maks;
            }
        }
        if (p[1]<m) {
            cout << "? " << p[0] << ' ' << p[1]+1 << ' ' << p[2] << endl;
            int l;
            cin >> l;
            if (l > maks) {
                p[1]++;
                l = maks;
            }
        }
        if (p[2]>1) {
            cout << "? " << p[0] << ' ' << p[1] << ' ' << p[2]-1 << endl;
            int l;
            cin >> l;
            if (l > maks) {
                p[2]--;
                l = maks;
            }
        }
        if (p[2]<k) {
            cout << "? " << p[0] << ' ' << p[1] << ' ' << p[2]+1 << endl;
            int l;
            cin >> l;
            if (l > maks) {
                p[2]++;
                l = maks;
            }
        }
    }
}
#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...