Submission #1588153
Source Code Expand
#include <iostream> #include <iomanip> #include <string> #include <algorithm> #include <math.h> #include <time.h> using namespace std; int main() { long long int n, a[5000], b[5000], c[5000], d[5000], cnt[101] = {}, ans[101] = {}; cin >> n; for (int i = 1; i <= (n*(n - 1) / 2); i++) { cin >> a[i] >> b[i] >> c[i] >> d[i]; if (c[i] > d[i]) { cnt[a[i]] += 3; } if (c[i] == d[i]) { cnt[a[i]]++; cnt[b[i]]++; } if (c[i] < d[i]) { cnt[b[i]] += 3; } ans[i] = 1; } long long int yan[101] = {}; for (int i = 1; i <= n; i++) { yan[i] = cnt[i]; } sort(yan + 1, yan + 1 + n); long long int f = 1; for (int i = n-1; i >= 1; i--) { if (yan[i] == yan[i + 1]) { f++; } else { for (int j = i; j >= 1; j--) { ans[j] += f; } f = 1; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (cnt[i] == yan[j]) { cout << ans[j] << endl; break; } } } }
Submission Info
Submission Time | |
---|---|
Task | B - サッカー (Soccer) |
User | littlegirl112 |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 986 Byte |
Status | AC |
Exec Time | 5 ms |
Memory | 384 KB |
Judge Result
Set Name | set01 | set02 | set03 | set04 | set05 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 20 / 20 | 20 / 20 | 20 / 20 | 20 / 20 | 20 / 20 | ||||||||||
Status |
|
|
|
|
|
Set Name | Test Cases |
---|---|
set01 | data1 |
set02 | data2 |
set03 | data3 |
set04 | data4 |
set05 | data5 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
data1 | AC | 1 ms | 256 KB |
data2 | AC | 5 ms | 384 KB |
data3 | AC | 5 ms | 384 KB |
data4 | AC | 5 ms | 384 KB |
data5 | AC | 5 ms | 384 KB |