| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 641250 | lto5 | Med (COCI22_med) | C++14 | 15 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
string s[505];
int b[505][10];
int tot[505];
int n;
int idx[505];
bool cmp (const int& x, const int& y) {
if (tot[x] != tot[y])
return tot[x] > tot[y];
return s[x] < s[y];
}
int find_best (int cur_idx) {
tot[cur_idx] += 500;
sort(idx + 1, idx + 1 + n, cmp);
tot[cur_idx] -= 500;
for (int i = 1; i <= n; i++) {
if (idx[i] == cur_idx) {
return i;
}
}
}
int find_worst (int cur_idx) {
for (int i = 1; i <= n; i++) {
if (i != cur_idx)
tot[i] += 500;
}
sort(idx + 1, idx + 1 + n, cmp);
for (int i = 1; i <= n; i++) {
if (i != cur_idx)
tot[i] -= 500;
}
for (int i = 1; i <= n; i++) {
if (idx[i] == cur_idx) {
return i;
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> s[i];
for (int j = 1; j <= 5; j++) {
cin >> b[i][j];
tot[i] += b[i][j];
}
idx[i] = i;
}
for (int i = 1; i <= n; i++) {
// iota(idx + 1, idx + 1 + n, 1);
// for (int j = 1; j <= n; j++)
// cout << idx[j] << " ";
// cout << "done" << endl;
cout << find_best(i) << " " << find_worst(i) << '\n';
}
return 0;
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
