Submission #557563

# Submission time Handle Problem Language Result Execution time Memory
557563 2022-05-05T13:10:35 Z Mounir Inside information (BOI21_servers) C++14
0 / 100
352 ms 1604 KB
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define print(x) cout << #x << " est " << x << endl;
#define x first
#define y second
#define int long long
using namespace std;
 
const int N = 2e5;
int date[N];
 
signed main(){  
      int nServs, nReqs; cin >> nServs >> nReqs;
      int ip = 1;
      nReqs += nServs - 1;
      while (nReqs--){
            char t; cin >> t;
            if (t == 'S'){
                  int a, b; cin >> a >> b;
                  date[max(a, b)] = ip++;
            }
            else if (t == 'Q'){
                  int a, d; cin >> a >> d;
                  if (min(a, d) == 1){
                        if (date[max(a, d)] == 0) cout << "no" << endl;
                        else cout << "yes" << endl;
                  }
                  else {
                        if (date[a] == 0 || date[d] == 0 || date[d] > date[a]) cout << "no" << endl;
                        else cout << "yes" << endl;
                  }
            }
            else {
                  int d; cin >> d;
                  if (date[d] != 0)
                        cout << ip - date[d] + 1 << endl;
                  else if (d == 1)
                        cout << ip << endl;
                  else
                        cout << 1 << endl;
            }
      }
      return 0;   
}
# Verdict Execution time Memory Grader output
1 Incorrect 220 ms 564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 220 ms 564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 230 ms 600 KB Output is correct
2 Incorrect 352 ms 1604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 230 ms 600 KB Output is correct
2 Incorrect 352 ms 1604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 218 ms 584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 218 ms 584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 218 ms 612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 218 ms 612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 257 ms 556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 257 ms 556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 224 ms 568 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 224 ms 568 KB Output isn't correct
2 Halted 0 ms 0 KB -