Submission #57921
Source Code Expand
#include <iostream> #include <vector> using namespace std; typedef long long Long; int main() { int n; cin >> n; vector<int> a(n), b(n); Long s = 0, m = 0; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; s += a[i]; m += b[i]; } vector<int> q(n), r(n); while (true) { Long rest = m; for (int i = 0; i < n; i++) { q[i] = (m * a[i]) / s; r[i] = (m * a[i]) % s; if (q[i] + 1 < b[i]) goto fail; rest -= q[i]; } for (int i = 0; i < n; i++) { if (q[i] >= b[i]) continue; int k = 0; for (int j = 0; j < n; j++) { if (r[i] < r[j] || (r[i] == r[j] && i > j)) ++k; } if (k >= rest) goto fail; } break; // good fail: ++m; } cout << m << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - 選挙 |
User | yuizumi |
Language | C++ (G++ 4.6.4) |
Score | 50 |
Code Size | 949 Byte |
Status | TLE |
Exec Time | 2037 ms |
Memory | 832 KB |
Judge Result
Set Name | Bubunten | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 50 / 50 | 0 / 150 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Bubunten | small01.txt, small02.txt, small03.txt, small04.txt, small05.txt, small06.txt, small07.txt, small08.txt, small09.txt, small10.txt, small11.txt, small12.txt, small13.txt, small14.txt, small15.txt, small16.txt, small17.txt, small18.txt, small19.txt, small20.txt, small21.txt, small22.txt, small23.txt, small24.txt, small25.txt, sample1.txt, sample2.txt, sample3.txt, 20_minimal.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 20_minimal.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, 49.txt, 50.txt, 51.txt, 52.txt, 53.txt, 54.txt, 55.txt, 56.txt, 57.txt, 58.txt, 59.txt, 60.txt, dekai1.txt, dekai2.txt, small01.txt, small02.txt, small03.txt, small04.txt, small05.txt, small06.txt, small07.txt, small08.txt, small09.txt, small10.txt, small11.txt, small12.txt, small13.txt, small14.txt, small15.txt, small16.txt, small17.txt, small18.txt, small19.txt, small20.txt, small21.txt, small22.txt, small23.txt, small24.txt, small25.txt, yabame1.txt, yabame2.txt, yabame3.txt, yabame4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | TLE | 2028 ms | 824 KB |
02.txt | TLE | 2028 ms | 748 KB |
03.txt | TLE | 2028 ms | 820 KB |
04.txt | TLE | 2036 ms | 820 KB |
05.txt | TLE | 2027 ms | 816 KB |
06.txt | AC | 687 ms | 788 KB |
07.txt | AC | 172 ms | 696 KB |
08.txt | TLE | 2022 ms | 792 KB |
09.txt | AC | 215 ms | 784 KB |
10.txt | AC | 863 ms | 788 KB |
11.txt | TLE | 2028 ms | 816 KB |
12.txt | TLE | 2028 ms | 820 KB |
13.txt | TLE | 2028 ms | 820 KB |
14.txt | TLE | 2028 ms | 820 KB |
15.txt | TLE | 2028 ms | 820 KB |
16.txt | TLE | 2028 ms | 816 KB |
17.txt | TLE | 2028 ms | 816 KB |
18.txt | TLE | 2028 ms | 828 KB |
19.txt | TLE | 2028 ms | 784 KB |
20.txt | TLE | 2028 ms | 832 KB |
20_minimal.txt | AC | 20 ms | 784 KB |
21.txt | TLE | 2037 ms | 808 KB |
22.txt | TLE | 2028 ms | 812 KB |
23.txt | TLE | 2029 ms | 824 KB |
24.txt | TLE | 2028 ms | 828 KB |
25.txt | TLE | 2028 ms | 820 KB |
26.txt | TLE | 2028 ms | 824 KB |
27.txt | TLE | 2027 ms | 816 KB |
28.txt | TLE | 2033 ms | 796 KB |
29.txt | TLE | 2028 ms | 828 KB |
30.txt | TLE | 2028 ms | 824 KB |
31.txt | TLE | 2028 ms | 824 KB |
32.txt | TLE | 2028 ms | 824 KB |
33.txt | TLE | 2028 ms | 824 KB |
34.txt | TLE | 2028 ms | 832 KB |
35.txt | TLE | 2028 ms | 776 KB |
36.txt | TLE | 2028 ms | 824 KB |
37.txt | TLE | 2027 ms | 816 KB |
38.txt | TLE | 2028 ms | 828 KB |
39.txt | TLE | 2033 ms | 824 KB |
40.txt | TLE | 2028 ms | 820 KB |
41.txt | TLE | 2028 ms | 820 KB |
42.txt | TLE | 2029 ms | 812 KB |
43.txt | TLE | 2029 ms | 824 KB |
44.txt | TLE | 2028 ms | 828 KB |
45.txt | TLE | 2028 ms | 828 KB |
46.txt | TLE | 2028 ms | 816 KB |
47.txt | TLE | 2028 ms | 824 KB |
48.txt | TLE | 2028 ms | 832 KB |
49.txt | TLE | 2029 ms | 828 KB |
50.txt | TLE | 2028 ms | 820 KB |
51.txt | TLE | 2028 ms | 816 KB |
52.txt | TLE | 2028 ms | 800 KB |
53.txt | TLE | 2028 ms | 832 KB |
54.txt | TLE | 2028 ms | 828 KB |
55.txt | TLE | 2028 ms | 824 KB |
56.txt | TLE | 2028 ms | 824 KB |
57.txt | TLE | 2028 ms | 824 KB |
58.txt | TLE | 2028 ms | 824 KB |
59.txt | TLE | 2034 ms | 816 KB |
60.txt | TLE | 2028 ms | 832 KB |
dekai1.txt | TLE | 2028 ms | 828 KB |
dekai2.txt | TLE | 2028 ms | 820 KB |
sample1.txt | AC | 19 ms | 788 KB |
sample2.txt | AC | 21 ms | 780 KB |
sample3.txt | AC | 20 ms | 700 KB |
small01.txt | AC | 30 ms | 780 KB |
small02.txt | AC | 19 ms | 788 KB |
small03.txt | AC | 19 ms | 788 KB |
small04.txt | AC | 20 ms | 788 KB |
small05.txt | AC | 19 ms | 788 KB |
small06.txt | AC | 19 ms | 784 KB |
small07.txt | AC | 19 ms | 780 KB |
small08.txt | AC | 25 ms | 688 KB |
small09.txt | AC | 29 ms | 704 KB |
small10.txt | AC | 20 ms | 784 KB |
small11.txt | AC | 35 ms | 788 KB |
small12.txt | AC | 22 ms | 628 KB |
small13.txt | AC | 39 ms | 776 KB |
small14.txt | AC | 21 ms | 788 KB |
small15.txt | AC | 47 ms | 788 KB |
small16.txt | AC | 22 ms | 652 KB |
small17.txt | AC | 30 ms | 628 KB |
small18.txt | AC | 23 ms | 652 KB |
small19.txt | AC | 20 ms | 692 KB |
small20.txt | AC | 20 ms | 788 KB |
small21.txt | AC | 22 ms | 692 KB |
small22.txt | AC | 21 ms | 780 KB |
small23.txt | AC | 20 ms | 672 KB |
small24.txt | AC | 20 ms | 788 KB |
small25.txt | AC | 20 ms | 784 KB |
yabame1.txt | TLE | 2028 ms | 820 KB |
yabame2.txt | AC | 612 ms | 640 KB |
yabame3.txt | AC | 1040 ms | 780 KB |
yabame4.txt | TLE | 2028 ms | 820 KB |