Submission #3539112


Source Code Expand

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

#define NDEBUG
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

void solve(int N, int M, vi& P, vi& Y) {
    vi ans(M, -1);
    vector<vector<ii>> w(N + 1);
    rep(i, M) {
        w[P[i]].pb(ii(Y[i], i));
    }
    rep1(pref, N) {
        sort(ALL(w[pref]));
        for (int j = 0, c = w[pref].size(); j < c; ++j) {
            int city = w[pref][j].second;
            ans[city] = 1+j;
        }
    }
    rep(i, M) {
        printf("%06d%06d\n", P[i], ans[i]);
    }
}

int main() {
    int N, M; scanf("%d %d", &N, &M);
    vi P(M), Y(M);
    rep(i,M) scanf("%d %d", &P[i], &Y[i]);
    solve(N,M,P,Y);
    return 0;
}

Submission Info

Submission Time
Task C - ID
User naoya_t
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1740 Byte
Status AC
Exec Time 48 ms
Memory 8192 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:57:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     int N, M; scanf("%d %d", &N, &M);
                                     ^
./Main.cpp:59:42: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     rep(i,M) scanf("%d %d", &P[i], &Y[i]);
                                          ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 21
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 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 AC 47 ms 7168 KB
02.txt AC 44 ms 3572 KB
03.txt AC 2 ms 2560 KB
04.txt AC 1 ms 256 KB
05.txt AC 47 ms 6004 KB
06.txt AC 48 ms 8192 KB
07.txt AC 3 ms 2048 KB
08.txt AC 43 ms 4352 KB
09.txt AC 47 ms 7168 KB
10.txt AC 47 ms 5940 KB
11.txt AC 42 ms 5760 KB
12.txt AC 30 ms 4096 KB
13.txt AC 42 ms 3712 KB
14.txt AC 48 ms 7168 KB
15.txt AC 48 ms 7168 KB
16.txt AC 48 ms 7168 KB
17.txt AC 48 ms 7168 KB
18.txt AC 48 ms 7168 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB