Submission #72461196
Source Code Expand
Copy
#include <stdio.h>#include <stdlib.h>struct meow {int id, score;};/* score の降順 */int cmp(const void* x, const void* y) {struct meow a = *(const struct meow*)x, b = *(const struct meow*)y;return (a.score < b.score) - (a.score > b.score);}struct meow nyan[114514];int ans[114514];int main(void) {int n, i;int cur = 0;if (scanf("%d", &n) != 1) return 1;for (i = 0; i < n; i++) {
#include <stdio.h>
#include <stdlib.h>
struct meow {
int id, score;
};
/* score の降順 */
int cmp(const void* x, const void* y) {
struct meow a = *(const struct meow*)x, b = *(const struct meow*)y;
return (a.score < b.score) - (a.score > b.score);
}
struct meow nyan[114514];
int ans[114514];
int main(void) {
int n, i;
int cur = 0;
if (scanf("%d", &n) != 1) return 1;
for (i = 0; i < n; i++) {
if (scanf("%d", &nyan[i].score) != 1) return 1;
nyan[i].id = i;
}
qsort(nyan, n, sizeof(*nyan), cmp);
for (i = 0; i < n; i++) {
if (i == 0 || nyan[i - 1].score != nyan[i].score) cur = i + 1;
ans[nyan[i].id] = cur;
}
for (i = 0; i < n; i++) {
printf("%d\n", ans[i]);
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | score - 得点 (Score) |
| User | mikecat |
| Language | C23 (GCC 14.2.0) |
| Score | 100 |
| Code Size | 740 Byte |
| Status | AC |
| Exec Time | 17 ms |
| Memory | 3196 KiB |
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 | 01 |
| Set02 | 02 |
| Set03 | 03 |
| Set04 | 04 |
| Set05 | 05 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01 | AC | 0 ms | 1652 KiB |
| 02 | AC | 0 ms | 1572 KiB |
| 03 | AC | 16 ms | 3188 KiB |
| 04 | AC | 16 ms | 3096 KiB |
| 05 | AC | 17 ms | 3196 KiB |