Task: | Bored Uolevi |
Sender: | AVL-tiimi |
Submission time: | 2017-09-19 18:45:51 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | ACCEPTED | 0.05 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | WRONG ANSWER | 0.12 s | details |
#5 | WRONG ANSWER | 0.10 s | details |
#6 | WRONG ANSWER | 0.13 s | details |
#7 | WRONG ANSWER | 0.11 s | details |
#8 | WRONG ANSWER | 0.09 s | details |
#9 | WRONG ANSWER | 0.09 s | details |
#10 | WRONG ANSWER | 0.19 s | details |
#11 | WRONG ANSWER | 0.14 s | details |
#12 | WRONG ANSWER | 0.08 s | details |
#13 | WRONG ANSWER | 0.11 s | details |
#14 | WRONG ANSWER | 0.16 s | details |
#15 | WRONG ANSWER | 0.16 s | details |
#16 | WRONG ANSWER | 0.18 s | details |
#17 | WRONG ANSWER | 0.15 s | details |
#18 | WRONG ANSWER | 0.23 s | details |
#19 | ACCEPTED | 0.14 s | details |
#20 | ACCEPTED | 0.06 s | details |
#21 | ACCEPTED | 0.04 s | details |
#22 | ACCEPTED | 0.04 s | details |
Code
#include <iostream> using namespace std; int t[2000][2000]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for (int i = 0; i < n; ++i) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; if (x1 == x2 || y1 == y2) continue; if (x1 > x2) swap(x1, x2), swap(y1, y2); long double k = (long double)(y2-y1)/(long double)(x2-x1); long double b = -k*x1+y1; for (int i = x1; i < x2; ++i) { long double ymin, ymax; if (y1 < y2) { ymin = k*i+b; ymax = k*(i+1)+b; } else { ymin = k*(i+1)+b; ymax = k*i+b; } for (int j = int(ymin); j < ymax-1e-8; ++j) { t[i][j] = 1; } } } int sum = 0; for (int i = 0; i < 2000; ++i) { for (int j = 0; j < 2000; ++j) { sum += t[i][j]; } } cout << sum << endl; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
3 0 0 5 5 0 5 5 0 0 5 5 0 |
correct output |
---|
9 |
user output |
---|
9 |
Test 2
Verdict: ACCEPTED
input |
---|
1 0 0 4 3 |
correct output |
---|
6 |
user output |
---|
6 |
Test 3
Verdict: ACCEPTED
input |
---|
2 0 0 4 3 1 0 3 3 |
correct output |
---|
6 |
user output |
---|
6 |
Test 4
Verdict: WRONG ANSWER
input |
---|
2000 1720 121 1506 1981 477 134 1088 1890 1219 594 628 1010 650 1512 115 1859 ... |
correct output |
---|
1784643 |
user output |
---|
1784822 |
Test 5
Verdict: WRONG ANSWER
input |
---|
2000 409 388 1224 1446 334 505 914 1979 427 622 811 1597 1714 457 20 1682 ... |
correct output |
---|
1775295 |
user output |
---|
1775598 |
Test 6
Verdict: WRONG ANSWER
input |
---|
2000 1743 735 874 1470 779 1076 1244 1660 704 1244 1136 399 1350 1110 41 686 ... |
correct output |
---|
1783040 |
user output |
---|
1783232 |
Test 7
Verdict: WRONG ANSWER
input |
---|
2000 1500 1420 1914 482 1506 158 119 345 1772 787 1549 141 1032 1561 318 1529 ... |
correct output |
---|
1755891 |
user output |
---|
1756159 |
Test 8
Verdict: WRONG ANSWER
input |
---|
2000 1276 1427 1714 1359 824 118 72 1042 252 1154 921 1831 1951 742 546 205 ... |
correct output |
---|
1790303 |
user output |
---|
1790547 |
Test 9
Verdict: WRONG ANSWER
input |
---|
2000 1624 1147 884 41 1917 1503 321 1182 324 1656 1432 87 441 1388 1894 1020 ... |
correct output |
---|
1781162 |
user output |
---|
1781323 |
Test 10
Verdict: WRONG ANSWER
input |
---|
2000 64 1000 1478 678 1228 1904 49 1198 1544 1330 1825 1037 100 277 291 608 ... |
correct output |
---|
1763650 |
user output |
---|
1763811 |
Test 11
Verdict: WRONG ANSWER
input |
---|
2000 817 354 1426 168 1163 905 1346 33 631 8 1256 160 1511 1407 998 1021 ... |
correct output |
---|
1787840 |
user output |
---|
1788057 |
Test 12
Verdict: WRONG ANSWER
input |
---|
2000 864 391 493 1719 1414 955 1430 415 739 502 1061 383 56 31 174 1303 ... |
correct output |
---|
1779897 |
user output |
---|
1780056 |
Test 13
Verdict: WRONG ANSWER
input |
---|
2000 1679 692 1203 242 998 850 998 255 1615 1233 1412 1956 162 1991 98 1409 ... |
correct output |
---|
1769951 |
user output |
---|
1770085 |
Test 14
Verdict: WRONG ANSWER
input |
---|
2000 679 2000 2000 0 0 1508 2000 0 0 1408 2000 0 795 2000 2000 0 ... |
correct output |
---|
3105373 |
user output |
---|
3105587 |
Test 15
Verdict: WRONG ANSWER
input |
---|
2000 0 927 2000 0 206 2000 2000 0 0 1594 2000 0 0 1546 2000 0 ... |
correct output |
---|
3084266 |
user output |
---|
3084393 |
Test 16
Verdict: WRONG ANSWER
input |
---|
2000 0 538 2000 0 105 2000 2000 0 0 885 2000 0 672 2000 2000 0 ... |
correct output |
---|
3086598 |
user output |
---|
3086779 |
Test 17
Verdict: WRONG ANSWER
input |
---|
2000 1368 2000 2000 0 411 2000 2000 0 0 833 2000 0 0 1961 2000 0 ... |
correct output |
---|
3104601 |
user output |
---|
3104953 |
Test 18
Verdict: WRONG ANSWER
input |
---|
2000 0 818 2000 0 48 2000 2000 0 1277 2000 2000 0 0 1577 2000 0 ... |
correct output |
---|
3115062 |
user output |
---|
3115225 |
Test 19
Verdict: ACCEPTED
input |
---|
2000 0 0 2000 1 0 1 2000 2 0 2 2000 3 0 3 2000 4 ... |
correct output |
---|
4000000 |
user output |
---|
4000000 |
Test 20
Verdict: ACCEPTED
input |
---|
3 2000 0 0 2000 0 0 1 1 2000 1999 1999 2000 |
correct output |
---|
2002 |
user output |
---|
2002 |
Test 21
Verdict: ACCEPTED
input |
---|
1 0 0 1 1 |
correct output |
---|
1 |
user output |
---|
1 |
Test 22
Verdict: ACCEPTED
input |
---|
2 0 0 1 1 0 1 1 0 |
correct output |
---|
1 |
user output |
---|
1 |