Submission #25620331


Source Code Expand

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

int main() {
  int L, Q;
  cin >> L >> Q;

  set<int> S;
  S.insert(0);
  S.insert(L);

  int c, x;
  for (int i = 0; i < Q; i++) {
    cin >> c >> x;
    if (c == 1) {
      S.insert(x);
    } else if (c == 2) {
      set<int>::iterator it = S.lower_bound(x);
      cout << (*it - *prev(it)) << endl;
    }
  }

  return 0;
}

Submission Info

Submission Time
Task D - Cutting Woods
User ryo_ryo66
Language C++ (GCC 9.2.1)
Score 400
Code Size 396 Byte
Status AC
Exec Time 378 ms
Memory 12816 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 15
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_max_random_00.txt, 01_max_random_01.txt, 01_max_random_02.txt, 01_max_random_03.txt, 01_max_random_04.txt, 02_all_1_00.txt, 03_all_2_00.txt, 04_hack_00.txt, 04_hack_01.txt, 04_hack_02.txt, 04_hack_03.txt, 04_hack_04.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 7 ms 3452 KiB
00_sample_01.txt AC 2 ms 3440 KiB
00_sample_02.txt AC 2 ms 3408 KiB
01_max_random_00.txt AC 292 ms 8212 KiB
01_max_random_01.txt AC 287 ms 8104 KiB
01_max_random_02.txt AC 283 ms 8304 KiB
01_max_random_03.txt AC 284 ms 8208 KiB
01_max_random_04.txt AC 288 ms 8048 KiB
02_all_1_00.txt AC 151 ms 12816 KiB
03_all_2_00.txt AC 378 ms 3408 KiB
04_hack_00.txt AC 130 ms 12656 KiB
04_hack_01.txt AC 129 ms 12724 KiB
04_hack_02.txt AC 275 ms 8252 KiB
04_hack_03.txt AC 269 ms 8200 KiB
04_hack_04.txt AC 277 ms 8104 KiB