Submission #50819312


Source Code Expand

#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;

int main() {
  int N, T;
  cin >> N >> T;

  // 得点をキーとして、その得点を持つ選手の集合を値とするマップ
  map<long long int, set<int>> scoreToPlayers;
  vector<long long int> scores(N, 0);  // 各選手の現在の得点

  // 最初に全ての選手を得点0に追加
  for (int i = 0; i < N; i++) {
    scoreToPlayers[0].insert(i);
  }

  for (int i = 0; i < T; i++) {
    int A;
    long long int B;
    cin >> A >> B;
    A--;  // 選手のインデックスを0ベースに調整

    scoreToPlayers[scores[A]].erase(A);
    if (scoreToPlayers[scores[A]].empty()) {
      scoreToPlayers.erase(scores[A]);
    }

    scores[A] += B;

    scoreToPlayers[scores[A]].insert(A);

    cout << scoreToPlayers.size() << endl;
  }

  return 0;
}

Submission Info

Submission Time
Task D - Diversity of Scores
User noyan
Language C++ 23 (gcc 12.2)
Score 400
Code Size 866 Byte
Status AC
Exec Time 508 ms
Memory 25284 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 22
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_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_max_00.txt, 02_max_01.txt, 03_killer_00.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3612 KiB
00_sample_01.txt AC 1 ms 3532 KiB
00_sample_02.txt AC 1 ms 3532 KiB
01_random_00.txt AC 434 ms 13944 KiB
01_random_01.txt AC 371 ms 4840 KiB
01_random_02.txt AC 470 ms 16500 KiB
01_random_03.txt AC 451 ms 13428 KiB
01_random_04.txt AC 484 ms 18212 KiB
01_random_05.txt AC 443 ms 12980 KiB
01_random_06.txt AC 490 ms 19984 KiB
01_random_07.txt AC 467 ms 17596 KiB
01_random_08.txt AC 484 ms 21620 KiB
01_random_09.txt AC 476 ms 20500 KiB
01_random_10.txt AC 495 ms 23244 KiB
01_random_11.txt AC 456 ms 16380 KiB
01_random_12.txt AC 494 ms 24548 KiB
01_random_13.txt AC 397 ms 5936 KiB
01_random_14.txt AC 508 ms 25284 KiB
01_random_15.txt AC 455 ms 14228 KiB
02_max_00.txt AC 331 ms 13980 KiB
02_max_01.txt AC 430 ms 13912 KiB
03_killer_00.txt AC 318 ms 13960 KiB