Submission #64285369
Source Code Expand
Copy
#include <bits/stdc++.h>#define int long long//#define USE_FREOPEN//#define MUL_TEST#define FILENAME ""using namespace std;pair<int,int> p[105];int ans[105];bool cmp(pair<int,int> x,pair<int,int> y) {return x > y;}void solve() {int n;cin >> n;for (int i = 1; i <= n; i++) {cin >> p[i].first;p[i].second = i;}sort(p + 1,p + n + 1,cmp);
#include <bits/stdc++.h> #define int long long //#define USE_FREOPEN //#define MUL_TEST #define FILENAME "" using namespace std; pair<int,int> p[105]; int ans[105]; bool cmp(pair<int,int> x,pair<int,int> y) { return x > y; } void solve() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> p[i].first; p[i].second = i; } sort(p + 1,p + n + 1,cmp); for (int i = 1,j = 1; j <= n; ) { int cnt = 0; int st = p[j].first; while (p[j].first == st) { cnt++; ans[p[j].second] = i; j++; } i += cnt; } for (int i = 1; i <= n; i++) { cout << ans[i] << '\n'; } } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #ifdef USE_FREOPEN freopen(FILENAME ".in","r",stdin); freopen(FILENAME ".out","w",stdout); #endif int _ = 1; #ifdef MUL_TEST cin >> _; #endif while (_--) solve(); _^=_; return 0^_^0; }
Submission Info
Submission Time | |
---|---|
Task | B - Ranking with Ties |
User | Hyh12377 |
Language | C++ 20 (gcc 12.2) |
Score | 200 |
Code Size | 937 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3524 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 03_sorted_00.txt, 03_sorted_01.txt, 04_handmade_00.txt, 04_handmade_01.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3464 KB |
00_sample_01.txt | AC | 1 ms | 3520 KB |
00_sample_02.txt | AC | 1 ms | 3524 KB |
00_sample_03.txt | AC | 1 ms | 3456 KB |
01_random_00.txt | AC | 1 ms | 3408 KB |
01_random_01.txt | AC | 1 ms | 3520 KB |
01_random_02.txt | AC | 1 ms | 3468 KB |
01_random_03.txt | AC | 1 ms | 3464 KB |
02_random2_00.txt | AC | 1 ms | 3472 KB |
02_random2_01.txt | AC | 1 ms | 3324 KB |
02_random2_02.txt | AC | 1 ms | 3464 KB |
02_random2_03.txt | AC | 1 ms | 3404 KB |
02_random2_04.txt | AC | 1 ms | 3472 KB |
02_random2_05.txt | AC | 1 ms | 3320 KB |
02_random2_06.txt | AC | 1 ms | 3448 KB |
02_random2_07.txt | AC | 1 ms | 3384 KB |
02_random2_08.txt | AC | 1 ms | 3408 KB |
03_sorted_00.txt | AC | 1 ms | 3400 KB |
03_sorted_01.txt | AC | 1 ms | 3328 KB |
04_handmade_00.txt | AC | 1 ms | 3520 KB |
04_handmade_01.txt | AC | 1 ms | 3328 KB |