Submission #19867365
Source Code Expand
#include <atcoder/all>
using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = 3.14159265359;
int d[100001];
int v[100001][3];
int main()
{
int n;
cin >> n;
vector<pair<int,int>> p(n);
for (int i = 0; i < n; i++){
int r, h;
cin >> r >> h;
p[i] = make_pair(r, h);
d[r]++;
v[r][h-1]++;
}
for (int i = 1; i <= 100000; i++){
d[i] += d[i-1];
}
for (int i = 0; i < n; i++){
int r = p[i].first;
int h = p[i].second;
int nwin = d[r-1]; // with lesser rate
if (h == 1){
nwin += v[r][2-1];
} else if (h == 2){
nwin += v[r][3-1];
} else /* h == 3 */ {
nwin += v[r][1-1];
}
int ndraw = v[r][h-1] - 1;
int nlose = (n-1) - nwin - ndraw;
cout << nwin << " " << nlose << " " << ndraw << endl;;
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - AtCoderでじゃんけんを |
| User | unnohideyuki |
| Language | C++ (GCC 9.2.1) |
| Score | 100 |
| Code Size | 913 Byte |
| Status | AC |
| Exec Time | 197 ms |
| Memory | 5576 KiB |
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, sample_01.txt, sample_02.txt, sample_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 195 ms | 5576 KiB |
| 02.txt | AC | 194 ms | 5572 KiB |
| 03.txt | AC | 181 ms | 4360 KiB |
| 04.txt | AC | 184 ms | 4424 KiB |
| 05.txt | AC | 182 ms | 4236 KiB |
| 06.txt | AC | 180 ms | 4252 KiB |
| 07.txt | AC | 179 ms | 4568 KiB |
| 08.txt | AC | 177 ms | 4156 KiB |
| 09.txt | AC | 181 ms | 4228 KiB |
| 10.txt | AC | 182 ms | 4088 KiB |
| 11.txt | AC | 187 ms | 5412 KiB |
| 12.txt | AC | 190 ms | 5572 KiB |
| 13.txt | AC | 185 ms | 5408 KiB |
| 14.txt | AC | 189 ms | 4144 KiB |
| 15.txt | AC | 187 ms | 4228 KiB |
| 16.txt | AC | 190 ms | 4232 KiB |
| 17.txt | AC | 191 ms | 4092 KiB |
| 18.txt | AC | 188 ms | 4236 KiB |
| 19.txt | AC | 197 ms | 5560 KiB |
| 20.txt | AC | 193 ms | 5560 KiB |
| 21.txt | AC | 192 ms | 5416 KiB |
| 22.txt | AC | 197 ms | 5480 KiB |
| 23.txt | AC | 192 ms | 5464 KiB |
| 24.txt | AC | 195 ms | 5412 KiB |
| 25.txt | AC | 9 ms | 3820 KiB |
| 26.txt | AC | 4 ms | 3892 KiB |
| 27.txt | AC | 3 ms | 3992 KiB |
| 28.txt | AC | 2 ms | 3816 KiB |
| sample_01.txt | AC | 2 ms | 3888 KiB |
| sample_02.txt | AC | 2 ms | 3896 KiB |
| sample_03.txt | AC | 5 ms | 3828 KiB |