Submission #3535972


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <unordered_map>
#include <utility>

using namespace std;

void outputNum(long num) {
  if (num < 0) cout << "000000";
  else if (num < 10) cout << "00000" << num;
  else if (num < 100) cout << "0000" << num;
  else if (num < 1000) cout << "000" << num;
  else if (num < 10000) cout << "00" << num;
  else if (num < 100000) cout << "0" << num;
  else cout << num;
}

int main(void) {
  long N, M; // N: 県の数, M: 市の数
  cin >> N >> M;

  unordered_map< long, set< long > > data;
  vector< pair< long, long > > memo;

  for (long i = 0; i < M; i++) {
    long P, Y;
    cin >> P >> Y;
    data[P].insert(Y);
    memo.push_back(make_pair(P, Y));
  }

  for (auto it : memo) {
    long P = it.first;
    long Y = it.second;

    outputNum(P);
    outputNum(distance(data[P].begin(), data[P].find(Y)) + 1);
    cout << endl;
  }

  return 0;
}

Submission Info

Submission Time
Task C - ID
User set0gut1
Language C++14 (GCC 5.4.1)
Score 0
Code Size 971 Byte
Status

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
All 0 / 300 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01.txt 283 ms 13936 KB
02.txt
03.txt 1 ms 256 KB
04.txt 1 ms 256 KB
05.txt
06.txt 281 ms 16532 KB
07.txt 4 ms 384 KB
08.txt 286 ms 8560 KB
09.txt 280 ms 13936 KB
10.txt
11.txt 795 ms 7280 KB
12.txt 540 ms 5364 KB
13.txt 637 ms 7792 KB
14.txt 284 ms 13936 KB
15.txt 281 ms 13936 KB
16.txt 290 ms 13936 KB
17.txt 288 ms 14064 KB
18.txt 279 ms 13936 KB
sample_01.txt 1 ms 256 KB
sample_02.txt 1 ms 256 KB
sample_03.txt 1 ms 256 KB