Submission #9831279
Source Code Expand
Copy
Copy
- #include <stdio.h>
- #include <inttypes.h>
- int64_t zettaiti(int64_t asumikana) {
- return asumikana < 0 ? -asumikana : asumikana;
- }
- int main(void) {
- int N;
- int64_t T, A;
- int64_t H[1024];
- int i;
- int bestIndex;
- int64_t bestDiff;
- if (scanf("%d", &N) != 1) return 1;
- if (scanf("%" SCNd64 "%" SCNd64, &T, &A) != 2) return 1;
- T *= 1000;
- A *= 1000;
- for (i = 0; i < N; i++) {
- if (scanf("%" SCNd64, &H[i]) != 1) return 1;
- H[i] *= 1000;
- }
- bestIndex = 0;
- bestDiff = zettaiti(A - (T - H[0] * 6));
- for (i = 1; i < N; i++) {
- int64_t score = zettaiti(A - (T - H[i] * 6));
- if (score < bestDiff) {
- bestIndex = i;
- bestDiff = score;
- }
- }
- printf("%d\n", bestIndex + 1);
- return 0;
- }
#include <stdio.h> #include <inttypes.h> int64_t zettaiti(int64_t asumikana) { return asumikana < 0 ? -asumikana : asumikana; } int main(void) { int N; int64_t T, A; int64_t H[1024]; int i; int bestIndex; int64_t bestDiff; if (scanf("%d", &N) != 1) return 1; if (scanf("%" SCNd64 "%" SCNd64, &T, &A) != 2) return 1; T *= 1000; A *= 1000; for (i = 0; i < N; i++) { if (scanf("%" SCNd64, &H[i]) != 1) return 1; H[i] *= 1000; } bestIndex = 0; bestDiff = zettaiti(A - (T - H[0] * 6)); for (i = 1; i < N; i++) { int64_t score = zettaiti(A - (T - H[i] * 6)); if (score < bestDiff) { bestIndex = i; bestDiff = score; } } printf("%d\n", bestIndex + 1); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Palace |
User | mikecat |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 728 Byte |
Status | |
Exec Time | 1 ms |
Memory | 128 KB |
Test Cases
Set Name | Score / Max Score | Test Cases |
---|---|---|
Sample | 0 / 0 | sample_01.txt, sample_02.txt |
All | 0 / 200 | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, sample_01.txt, sample_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | 1 ms | 128 KB | |
02.txt | 1 ms | 128 KB | |
03.txt | 1 ms | 128 KB | |
04.txt | 1 ms | 128 KB | |
05.txt | 1 ms | 128 KB | |
06.txt | 1 ms | 128 KB | |
07.txt | 1 ms | 128 KB | |
08.txt | 1 ms | 128 KB | |
09.txt | 1 ms | 128 KB | |
10.txt | 1 ms | 128 KB | |
sample_01.txt | 1 ms | 128 KB | |
sample_02.txt | 1 ms | 128 KB |