Submission #3536297


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].lower_bound(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 978 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 277 ms 13936 KB
02.txt
03.txt 1 ms 256 KB
04.txt 1 ms 256 KB
05.txt
06.txt 258 ms 16532 KB
07.txt 4 ms 384 KB
08.txt 288 ms 8560 KB
09.txt 285 ms 13936 KB
10.txt
11.txt 789 ms 7280 KB
12.txt 541 ms 5364 KB
13.txt 627 ms 7792 KB
14.txt 275 ms 13936 KB
15.txt 271 ms 13936 KB
16.txt 274 ms 13936 KB
17.txt 279 ms 14064 KB
18.txt 281 ms 13936 KB
sample_01.txt 1 ms 256 KB
sample_02.txt 1 ms 256 KB
sample_03.txt 1 ms 256 KB