Submission #65199620
Source Code Expand
Copy
#include <stdio.h>int main(void) {int N, X, Y;int min = 0, max = -1;int i;if (scanf("%d%d%d", &N, &X, &Y) != 3) return 1;for (i = 0; i < N; i++) {int A, B;if (scanf("%d%d", &A, &B) != 2) return 1;if (X <= A) {/* 現時点で安い or 同じ → いつまで安いかを考える *//* Y <= B のとき、いつまでも安い */if (Y > B) {/* 何年差を詰めても抜かれないか (同じを含む) */int safe = (A - X) / (Y - B);if (max < 0 || safe < max) max = safe;}} else {/* 現時点で高い → いつから安いかを考える */if (Y >= B) {
#include <stdio.h> int main(void) { int N, X, Y; int min = 0, max = -1; int i; if (scanf("%d%d%d", &N, &X, &Y) != 3) return 1; for (i = 0; i < N; i++) { int A, B; if (scanf("%d%d", &A, &B) != 2) return 1; if (X <= A) { /* 現時点で安い or 同じ → いつまで安いかを考える */ /* Y <= B のとき、いつまでも安い */ if (Y > B) { /* 何年差を詰めても抜かれないか (同じを含む) */ int safe = (A - X) / (Y - B); if (max < 0 || safe < max) max = safe; } } else { /* 現時点で高い → いつから安いかを考える */ if (Y >= B) { /* いつまでも安くならない */ if (max < 0) max = 0; min = max + 1; } else { /* 何年差を詰めたら抜けるか (同じを含む) */ int towin = ((X - A) + (B - Y) - 1) / (B - Y); if (min < towin) min = towin; } } } puts(max < 0 || min <= max ? "Yes" : "No"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Annual Tuition |
User | mikecat |
Language | C (gcc 12.2.0) |
Score | 100 |
Code Size | 975 Byte |
Status | AC |
Exec Time | 101 ms |
Memory | 1656 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | corner_01.txt, corner_02.txt, corner_03.txt, corner_04.txt, corner_05.txt, corner_06.txt, corner_07.txt, corner_08.txt, corner_09.txt, corner_10.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
corner_01.txt | AC | 73 ms | 1652 KB |
corner_02.txt | AC | 74 ms | 1444 KB |
corner_03.txt | AC | 75 ms | 1624 KB |
corner_04.txt | AC | 75 ms | 1536 KB |
corner_05.txt | AC | 73 ms | 1648 KB |
corner_06.txt | AC | 75 ms | 1532 KB |
corner_07.txt | AC | 74 ms | 1504 KB |
corner_08.txt | AC | 75 ms | 1588 KB |
corner_09.txt | AC | 77 ms | 1612 KB |
corner_10.txt | AC | 76 ms | 1628 KB |
hand_01.txt | AC | 1 ms | 1620 KB |
hand_02.txt | AC | 0 ms | 1620 KB |
hand_03.txt | AC | 1 ms | 1596 KB |
hand_04.txt | AC | 0 ms | 1540 KB |
hand_05.txt | AC | 0 ms | 1584 KB |
hand_06.txt | AC | 1 ms | 1620 KB |
hand_07.txt | AC | 0 ms | 1624 KB |
hand_08.txt | AC | 1 ms | 1528 KB |
sample_01.txt | AC | 0 ms | 1536 KB |
sample_02.txt | AC | 1 ms | 1520 KB |
sample_03.txt | AC | 1 ms | 1624 KB |
test_01.txt | AC | 1 ms | 1624 KB |
test_02.txt | AC | 1 ms | 1612 KB |
test_03.txt | AC | 1 ms | 1652 KB |
test_04.txt | AC | 0 ms | 1632 KB |
test_05.txt | AC | 1 ms | 1580 KB |
test_06.txt | AC | 1 ms | 1656 KB |
test_07.txt | AC | 1 ms | 1624 KB |
test_08.txt | AC | 1 ms | 1612 KB |
test_09.txt | AC | 0 ms | 1556 KB |
test_10.txt | AC | 1 ms | 1540 KB |
test_11.txt | AC | 1 ms | 1628 KB |
test_12.txt | AC | 1 ms | 1536 KB |
test_13.txt | AC | 0 ms | 1528 KB |
test_14.txt | AC | 1 ms | 1592 KB |
test_15.txt | AC | 1 ms | 1596 KB |
test_16.txt | AC | 0 ms | 1580 KB |
test_17.txt | AC | 1 ms | 1624 KB |
test_18.txt | AC | 0 ms | 1548 KB |
test_19.txt | AC | 1 ms | 1624 KB |
test_20.txt | AC | 1 ms | 1628 KB |
test_21.txt | AC | 72 ms | 1624 KB |
test_22.txt | AC | 31 ms | 1612 KB |
test_23.txt | AC | 72 ms | 1652 KB |
test_24.txt | AC | 30 ms | 1520 KB |
test_25.txt | AC | 82 ms | 1624 KB |
test_26.txt | AC | 24 ms | 1624 KB |
test_27.txt | AC | 74 ms | 1512 KB |
test_28.txt | AC | 62 ms | 1564 KB |
test_29.txt | AC | 20 ms | 1652 KB |
test_30.txt | AC | 82 ms | 1536 KB |
test_31.txt | AC | 2 ms | 1652 KB |
test_32.txt | AC | 71 ms | 1612 KB |
test_33.txt | AC | 56 ms | 1624 KB |
test_34.txt | AC | 2 ms | 1556 KB |
test_35.txt | AC | 81 ms | 1500 KB |
test_36.txt | AC | 79 ms | 1444 KB |
test_37.txt | AC | 29 ms | 1628 KB |
test_38.txt | AC | 32 ms | 1588 KB |
test_39.txt | AC | 16 ms | 1652 KB |
test_40.txt | AC | 15 ms | 1612 KB |
test_41.txt | AC | 84 ms | 1588 KB |
test_42.txt | AC | 88 ms | 1532 KB |
test_43.txt | AC | 100 ms | 1596 KB |
test_44.txt | AC | 100 ms | 1596 KB |
test_45.txt | AC | 85 ms | 1616 KB |
test_46.txt | AC | 86 ms | 1628 KB |
test_47.txt | AC | 98 ms | 1568 KB |
test_48.txt | AC | 101 ms | 1532 KB |
test_49.txt | AC | 83 ms | 1584 KB |
test_50.txt | AC | 86 ms | 1620 KB |