Submission #696288

# Submission time Handle Problem Language Result Execution time Memory
696288 2023-02-06T07:14:43 Z Dan4Life Inside information (BOI21_servers) C++17
0 / 100
51 ms 3964 KB
#include <bits/stdc++.h>
using namespace std;
const int mxN = (int)120010;

int n, k, pos[mxN];
int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> k; int sz = 1;
    for(int _ = 0; _ < n+k-1; _++){
        char t; int x, y;
        cin >> t >> x;
        if(t=='S'){
            cin >> y;
            if(x>y)swap(x,y);
            pos[y]=sz++;
        }
        else if(t=='Q'){
            cin >> y;
            if(x==1) cout << (pos[y]?"yes":"no");
            else if(y==1) cout << (pos[x]?"yes":"no");
            else cout << (pos[x]>pos[y] and pos[x] and pos[y]?"yes":"no");

        }
        else{
            cout << sz-pos[x]+1;
        }
        if(t!='S') cout << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 1492 KB Output is correct
2 Incorrect 51 ms 3964 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 1492 KB Output is correct
2 Incorrect 51 ms 3964 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 1540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 1540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 1524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 1524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1480 KB Output isn't correct
2 Halted 0 ms 0 KB -