Submission #655078
Source Code Expand
#include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <functional> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF 1<<30 #define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0])) #define MP make_pair #define mp make_pair #define pb push_back #define PB push_back #define DEBUG(x) cout<<#x<<": "<<x<<endl #define ll long long #define ull unsigned long long #define MOD 1000000007 int data[100000][2]; map<int, vector< pair<int, int> > > rate; int result[100000][3]; int main(){ cin.tie(0); ios::sync_with_stdio(false); cout.precision(16); int n; cin >> n; REP(i, n) { int r, h; cin >> r >> h; data[i][0] = r; data[i][1] = h; rate[r].pb(mp(i, h)); } int accu = 0; for(auto elem : rate) { int size = elem.second.size(); if(size == 1) { int f = elem.second[0].first; result[f][0] = accu; result[f][1] = n - accu - 1; } else { for(int i = 1; i < 4; i++) { int tres[3] = {accu, (n - accu - size), -1}; REP(j, size) tres[abs((i - elem.second[j].second + 3) % 3 - 2)]++; REP(j, size) { int f = elem.second[j].first; int s = elem.second[j].second; if(s == i) { result[f][0] = tres[0]; result[f][1] = tres[1]; result[f][2] = tres[2]; } } } } accu += size; } // cout << "**RESULT**" << endl; REP(i, n) cout << result[i][0] << " " << result[i][1] << " " << result[i][2] << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - AtCoderでじゃんけんを |
User | yumechi |
Language | C++11 (GCC 4.9.2) |
Score | 100 |
Code Size | 1730 Byte |
Status | AC |
Exec Time | 466 ms |
Memory | 13608 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
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, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 383 ms | 9760 KB |
02.txt | AC | 398 ms | 9756 KB |
03.txt | AC | 318 ms | 3992 KB |
04.txt | AC | 333 ms | 4004 KB |
05.txt | AC | 304 ms | 4008 KB |
06.txt | AC | 380 ms | 4012 KB |
07.txt | AC | 353 ms | 4044 KB |
08.txt | AC | 416 ms | 4036 KB |
09.txt | AC | 355 ms | 4376 KB |
10.txt | AC | 347 ms | 4368 KB |
11.txt | AC | 430 ms | 13608 KB |
12.txt | AC | 455 ms | 13600 KB |
13.txt | AC | 414 ms | 13604 KB |
14.txt | AC | 339 ms | 4380 KB |
15.txt | AC | 309 ms | 4368 KB |
16.txt | AC | 308 ms | 4364 KB |
17.txt | AC | 309 ms | 3744 KB |
18.txt | AC | 310 ms | 3744 KB |
19.txt | AC | 395 ms | 9756 KB |
20.txt | AC | 412 ms | 9756 KB |
21.txt | AC | 441 ms | 9756 KB |
22.txt | AC | 466 ms | 9764 KB |
23.txt | AC | 465 ms | 9756 KB |
24.txt | AC | 439 ms | 9768 KB |
25.txt | AC | 27 ms | 920 KB |
26.txt | AC | 27 ms | 808 KB |
27.txt | AC | 28 ms | 928 KB |
28.txt | AC | 27 ms | 808 KB |
sample_01.txt | AC | 28 ms | 800 KB |
sample_02.txt | AC | 27 ms | 796 KB |
sample_03.txt | AC | 26 ms | 916 KB |