답안 #557529

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
557529 2022-05-05T12:36:54 Z Mounir Inside information (BOI21_servers) C++14
2.5 / 100
3500 ms 524288 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;
set<int> datas[N];

signed main(){  
      int nServs, nReqs; cin >> nServs >> nReqs;
      for (int i = 1; i <= nServs; ++i)
            datas[i] = {i};
      nReqs += nServs - 1;
      while (nReqs--){
            char typeReq; cin >> typeReq;
            if (typeReq == 'S'){
                  int a, b; cin >> a >> b;
                  for (int e : datas[b])
                        datas[a].insert(e);
                  datas[b] = datas[a];
            }
            else if (typeReq == 'Q'){
                  int a, d; cin >> a >> d;
                  if (datas[a].count(d)) cout << "yes" << endl;
                  else cout << "no" << endl;
            }
            else {
                  int d; cin >> d;
                  int nb = 0;
                  for (int a = 1; a <= nServs; ++a)
                        nb += datas[a].count(d);
                  cout << nb << endl;
            }
      }
      return 0;   
}
# 결과 실행 시간 메모리 Grader output
1 Correct 205 ms 10828 KB Output is correct
2 Correct 263 ms 12684 KB Output is correct
3 Correct 384 ms 58304 KB Output is correct
4 Correct 297 ms 12376 KB Output is correct
5 Correct 225 ms 12304 KB Output is correct
6 Correct 1416 ms 387484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 205 ms 10828 KB Output is correct
2 Correct 263 ms 12684 KB Output is correct
3 Correct 384 ms 58304 KB Output is correct
4 Correct 297 ms 12376 KB Output is correct
5 Correct 225 ms 12304 KB Output is correct
6 Correct 1416 ms 387484 KB Output is correct
7 Correct 249 ms 11096 KB Output is correct
8 Correct 3398 ms 12508 KB Output is correct
9 Execution timed out 3561 ms 30964 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 223 ms 10984 KB Output is correct
2 Runtime error 1470 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 223 ms 10984 KB Output is correct
2 Runtime error 1470 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 214 ms 10828 KB Output is correct
2 Correct 454 ms 38360 KB Output is correct
3 Correct 459 ms 38348 KB Output is correct
4 Runtime error 1423 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 214 ms 10828 KB Output is correct
2 Correct 454 ms 38360 KB Output is correct
3 Correct 459 ms 38348 KB Output is correct
4 Runtime error 1423 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 216 ms 10828 KB Output is correct
2 Runtime error 662 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 216 ms 10828 KB Output is correct
2 Runtime error 662 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 225 ms 10936 KB Output is correct
2 Correct 421 ms 38476 KB Output is correct
3 Correct 462 ms 38352 KB Output is correct
4 Runtime error 1402 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 225 ms 10936 KB Output is correct
2 Correct 421 ms 38476 KB Output is correct
3 Correct 462 ms 38352 KB Output is correct
4 Runtime error 1402 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 217 ms 10860 KB Output is correct
2 Correct 237 ms 12688 KB Output is correct
3 Correct 467 ms 58192 KB Output is correct
4 Correct 227 ms 12432 KB Output is correct
5 Correct 244 ms 12196 KB Output is correct
6 Correct 1404 ms 387484 KB Output is correct
7 Correct 219 ms 10924 KB Output is correct
8 Runtime error 1394 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 217 ms 10860 KB Output is correct
2 Correct 237 ms 12688 KB Output is correct
3 Correct 467 ms 58192 KB Output is correct
4 Correct 227 ms 12432 KB Output is correct
5 Correct 244 ms 12196 KB Output is correct
6 Correct 1404 ms 387484 KB Output is correct
7 Correct 219 ms 10924 KB Output is correct
8 Runtime error 1394 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -