QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#657069#9487. Vivid Colorsucup-team173#WA 0ms3564kbC++201.1kb2024-10-19 14:08:332024-10-19 14:08:33

Judging History

你现在查看的是最新测评结果

  • [2024-10-19 14:08:33]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3564kb
  • [2024-10-19 14:08:33]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

void solve() {
    int n;
    cin >> n;
    auto ask = [&](int i, int j) {
        cout << "? " << i << ' ' << j << endl;
        string s;
        cin >> s;
        return s[0] == 'R';
    };
    vector<vector<int>> tr(2);
    vector<vector<pair<int, int>>> es(2);
    tr[0].push_back(1), tr[1].push_back(1);
    for(int i = 2; i <= n; i++) {
        int col = ask(1, i);
        tr[col].push_back(i);
        es[col].push_back({1, i});
    }
    int sz[2] = {tr[0].size(), tr[1].size()};
    for(int i = 1, j = 1; es[0].size() < n - 1 && es[1].size() < n - 1; ) {
        int col = ask(tr[0][i], tr[1][j]);
        es[col].push_back({tr[0][i], tr[1][j]});
        if(col == 0) {
            j++;
        } else {
            i++;
        }
    }
    if(es[0].size() < n - 1) swap(es[0], es[1]);
    cout << "!\n";
    for(auto [i, j] : es[0]) cout << i << ' ' << j << endl;
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3564kb

input:

3
180 0 0
0 180 180
0 0 180

output:

? 1 2
? 1 3
!
1 2
1 3

result:

wrong answer 1st words differ - expected: '7200', found: '?'