結果

問題 No.618 labo-index
ユーザー n_knuun_knuu
提出日時 2017-11-26 23:10:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,259 bytes
コンパイル時間 2,075 ms
コンパイル使用メモリ 207,560 KB
実行使用メモリ 10,652 KB
最終ジャッジ日時 2024-05-05 13:58:36
合計ジャッジ時間 41,982 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 1,955 ms
5,376 KB
testcase_20 AC 2,605 ms
5,376 KB
testcase_21 AC 1,916 ms
5,376 KB
testcase_22 AC 2,082 ms
5,376 KB
testcase_23 AC 2,049 ms
5,376 KB
testcase_24 AC 1,887 ms
5,376 KB
testcase_25 AC 2,440 ms
5,376 KB
testcase_26 AC 2,020 ms
5,376 KB
testcase_27 AC 1,995 ms
5,376 KB
testcase_28 AC 1,890 ms
5,376 KB
testcase_29 AC 2,026 ms
5,376 KB
testcase_30 AC 1,871 ms
5,376 KB
testcase_31 AC 1,976 ms
5,376 KB
testcase_32 AC 2,403 ms
5,376 KB
testcase_33 AC 2,103 ms
5,376 KB
testcase_34 TLE -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

const ll INF = 1e18;

int main() {
  int Q; scanf("%d", &Q);
  vector<ll> labo_members;

  REP(q, Q) {
    int t; ll x; scanf("%d %lld", &t, &x);
    if (t == 1) {
      labo_members.emplace_back(x);
    } else if (t == 2) {
      x--;
      assert(labo_members[(int)x] != INF);
      labo_members[(int)x] = INF;
    } else if (t == 3) {
      REP(i, labo_members.size()) {
        if (labo_members[i] != INF) labo_members[i] += x;
      }
    }
    vector<ll> members;
    for (ll x : labo_members) {
      if (x != INF) members.emplace_back(x);
    }
    sort(ALL(members), greater<ll>());
    bool flag = false;
    REP(i, members.size()) {
      if ((ll)i + 1 > members[i]) {
        printf("%d\n", i);
        flag = true;
        break;
      }
    }
    if (not flag) {
      printf("%d\n", (int)members.size());
    }
  }
  return 0;
}
0