QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#457054 | #3224. Directions | propane | WA | 183ms | 21480kb | C++20 | 2.6kb | 2024-06-28 23:02:19 | 2024-06-28 23:02:20 |
Judging History
answer
#include<iostream>
#include<cstring>
#include<vector>
#include<numeric>
#include<map>
#include<algorithm>
using namespace std;
using LL = long long;
struct Point{
LL x, y;
LL operator*(const Point &t) const {
return x * t.x + y * t.y;
}
LL operator^(const Point &t) const {
return x * t.y - y * t.x;
}
int quad() const {
if (y < 0) return 1;
if (y > 0) return 4;
if (x < 0) return 5;
if (x > 0) return 2;
return 3;
}
bool operator<(const Point &t) const {
int q1 = quad(), q2 = t.quad();
if (q1 != q2) return q1 < q2;
return (*this ^ t) > 0;
}
};
int main(){
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
const LL INF = 1e18;
int n;
cin >> n;
map<Point, int> mp;
for(int i = 0; i < n; i++){
LL x, y; int p;
cin >> x >> y >> p;
if (x == 0 and y == 0) continue;
LL g = abs(gcd(x, y));
x /= g, y /= g;
if (!mp.contains({x, y})){
mp[{x, y}] = p;
}
else{
mp[{x, y}] = min(mp[{x, y}], p);
}
}
vector<Point> pt;
vector<int> p;
for(auto [x, y] : mp){
pt.push_back(x);
p.push_back(y);
}
if (pt.empty()){
cout << -1 << '\n';
return 0;
}
auto rot = [&](Point &s){
swap(s.x, s.y);
s.x = -s.x;
};
LL ans = INF;
for(auto s : pt){
LL sum = mp[s];
rot(s);
if (mp.contains(s)){
sum += mp[s];
}
else continue;
rot(s);
if (mp.contains(s)){
sum += mp[s];
}
else continue;
rot(s);
if (mp.contains(s)){
sum += mp[s];
}
else continue;
ans = min(ans, sum);
}
int mnpos = min_element(p.begin(), p.end()) - p.begin();
rotate(pt.begin(), pt.begin() + mnpos, pt.end());
rotate(p.begin(), p.begin() + mnpos, p.end());
int j = 1;
while(j < n and (pt[0] ^ pt[j]) >= 0) j++;
int ed = 1;
while(ed < n and (pt[0] ^ pt[ed]) > 0) ed++;
j--;
LL mn = INF;
for(int i = 1; i < ed; i++){
while(j + 1 < n and (pt[i] ^ pt[j + 1]) > 0){
mn = min(mn, 1LL * p[++j]);
}
ans = min(ans, p[0] + p[i] + mn);
}
if (ans > INF / 2) ans = -1;
cout << ans << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 22ms
memory: 3668kb
input:
200000 -1 -1 1 1 1 1 0 1 1 1 0 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 -1 1 0 1 1 0 0 1 0 0 1 1 -1 1 -1 -1 1 0 0 1 1 0 1 -1 1 1 -1 1 1 1 1 1 1 1 1 -1 1 1 0 -1 1 1 -1 1 -1 0 1 1 0 1 1 -1 1 0 -1 1 1 0 1 -1 1 1 1 0 1 -1 0 1 1 1 1 1 0 1 -1 -1 1 -1 1 1 -1 -1 1 0 -1 1 0 -1 1 1 1 1 1 -1 1 0 1 1 1 1 1 -1 1 1 1 -1 1 0...
output:
3
result:
ok single line: '3'
Test #2:
score: 0
Accepted
time: 25ms
memory: 3540kb
input:
200000 -1 -1 2 1 0 1 1 0 2 1 -1 2 1 0 1 -1 1 1 -1 -1 2 1 1 1 0 -1 2 -1 -1 1 0 1 2 0 -1 2 -1 0 2 0 0 2 -1 1 1 1 1 1 -1 0 1 1 -1 2 1 0 1 0 0 1 1 0 2 0 -1 1 0 1 1 0 -1 2 -1 1 2 0 1 2 -1 1 2 0 1 1 0 1 1 1 1 2 1 1 1 1 0 2 1 1 2 -1 1 2 -1 1 1 0 1 2 0 -1 2 1 0 2 0 1 1 0 -1 1 1 -1 1 1 0 2 0 -1 1 -1 0 1 0 -1...
output:
3
result:
ok single line: '3'
Test #3:
score: 0
Accepted
time: 31ms
memory: 3868kb
input:
200000 1 0 555860533 -1 1 633479355 0 0 411890838 -1 -1 411764668 0 0 324117889 1 1 147426106 1 0 41681213 1 -1 169580394 1 -1 204074237 -1 1 265787176 1 -1 204010614 0 -1 582574240 0 -1 98238758 1 1 489573021 -1 1 747647275 1 -1 933893240 0 -1 663924164 0 0 470849190 1 -1 479419247 -1 -1 53695974 0...
output:
95355
result:
ok single line: '95355'
Test #4:
score: 0
Accepted
time: 32ms
memory: 3576kb
input:
200000 -1 0 1 -2 2 1 0 0 1 1 1 1 2 -2 1 0 2 1 -1 -1 1 0 0 1 1 1 1 2 1 1 0 1 1 -2 -1 1 -1 -1 1 -2 2 1 -1 -2 1 0 0 1 -2 0 1 2 1 1 1 -2 1 1 -2 1 -1 -2 1 0 1 1 0 -1 1 1 -2 1 0 1 1 2 0 1 -1 1 1 1 0 1 2 -2 1 -1 2 1 -2 1 1 -1 0 1 2 1 1 0 1 1 -1 -1 1 0 2 1 2 2 1 2 -2 1 1 -2 1 -2 0 1 -2 -2 1 -2 1 1 1 2 1 2 -...
output:
3
result:
ok single line: '3'
Test #5:
score: 0
Accepted
time: 28ms
memory: 3564kb
input:
200000 -2 1 2 2 1 2 1 -1 2 1 2 2 -1 2 1 1 -1 2 1 -1 2 -2 -1 2 1 2 1 2 -1 2 0 1 2 1 -1 1 -2 2 1 -2 1 2 -1 0 2 2 0 1 1 -2 2 -1 1 1 1 -2 1 -2 1 2 -1 1 2 2 -2 1 -2 1 2 -2 1 1 -2 2 1 0 -2 1 2 -2 2 0 2 2 2 2 2 2 2 2 0 2 2 -2 2 2 1 -2 1 1 0 2 -1 -2 1 -2 1 2 0 -1 1 2 0 1 -1 -1 2 1 -2 1 -2 -2 1 1 -1 2 -2 2 1...
output:
3
result:
ok single line: '3'
Test #6:
score: 0
Accepted
time: 34ms
memory: 3560kb
input:
200000 -1 -2 29368112 2 -1 24391896 0 -2 58495223 0 1 266081519 -2 -2 381375524 2 1 738559870 2 -2 407460939 -1 1 562555301 -2 2 185971753 2 -1 886154605 1 1 842679105 1 0 300033644 2 1 430527773 -1 -1 295205658 -1 2 903654949 -2 2 674980542 2 -2 725974565 0 1 924537846 -2 1 828956777 0 2 145229295 ...
output:
50007
result:
ok single line: '50007'
Test #7:
score: 0
Accepted
time: 30ms
memory: 3660kb
input:
200000 -1 1 1 2 0 1 -2 2 1 -2 -2 1 -1 -1 1 1 0 1 1 -1 1 1 -1 1 2 0 1 2 -2 1 -3 -1 1 -1 3 1 0 0 1 2 3 1 -2 -1 1 3 0 1 -1 -3 1 -1 -1 1 -3 1 1 -1 0 1 -1 -3 1 -1 0 1 2 3 1 -3 3 1 -1 2 1 -3 0 1 3 2 1 -2 1 1 -2 -2 1 2 3 1 2 3 1 -3 -3 1 2 3 1 1 -1 1 -1 -2 1 1 1 1 -3 1 1 -2 0 1 -1 -3 1 1 -2 1 -2 0 1 1 -1 1 ...
output:
3
result:
ok single line: '3'
Test #8:
score: 0
Accepted
time: 26ms
memory: 3664kb
input:
200000 -1 3 2 -2 -2 2 1 -3 2 3 0 2 3 -3 1 2 1 1 -1 -3 2 0 0 2 1 0 2 1 0 1 -1 -1 2 1 2 2 -1 1 2 0 2 1 0 3 2 3 0 2 -1 -2 1 -3 -2 2 0 0 1 -3 -2 2 3 1 2 3 0 1 -2 2 1 -1 0 2 3 3 1 0 3 2 1 -1 1 -2 0 1 1 -1 2 2 3 2 -3 -3 1 2 0 2 0 -2 2 3 0 1 3 -2 2 -1 2 1 -1 0 2 1 2 1 2 1 1 1 -1 2 1 -1 1 -2 -1 2 0 -3 2 -1 ...
output:
3
result:
ok single line: '3'
Test #9:
score: 0
Accepted
time: 37ms
memory: 3632kb
input:
200000 1 -3 518137122 2 0 834424887 -3 -2 231423111 1 -2 504370653 0 -1 410088110 1 -3 604634228 0 -1 778458743 -2 0 372225547 -3 -3 213186092 -1 3 217495508 -1 0 897781531 -1 3 890144466 0 0 174193369 2 -2 392192299 3 -3 664301085 -1 2 394866190 3 -2 923710269 -1 -1 601337929 1 -3 519383120 0 -1 18...
output:
55780
result:
ok single line: '55780'
Test #10:
score: 0
Accepted
time: 38ms
memory: 3820kb
input:
200000 -6 7 1 1 -5 1 -5 -5 1 -1 3 1 -4 5 1 9 0 1 -2 -10 1 6 9 1 9 8 1 8 -3 1 0 3 1 -7 -7 1 1 9 1 3 -3 1 -5 -6 1 -9 5 1 -9 0 1 8 8 1 -2 -9 1 0 8 1 -10 2 1 1 -5 1 6 -7 1 4 3 1 4 -6 1 -9 10 1 -2 -1 1 9 8 1 -8 7 1 3 -6 1 0 10 1 0 10 1 -10 6 1 3 -9 1 8 -10 1 -5 6 1 -1 6 1 0 2 1 -1 -5 1 6 8 1 1 -9 1 8 4 1...
output:
3
result:
ok single line: '3'
Test #11:
score: 0
Accepted
time: 38ms
memory: 3644kb
input:
200000 6 -8 2 -5 9 2 0 -4 2 -2 -9 1 7 8 2 10 8 2 -5 5 2 4 3 1 -8 -7 2 -1 0 1 -2 -3 1 -9 -6 1 10 7 2 1 -8 2 -3 -4 2 -8 9 1 5 -3 2 -10 -5 2 -8 10 2 2 -7 2 7 -8 1 -9 -1 2 -4 6 2 -2 10 2 3 0 1 -7 2 1 -2 10 2 9 4 2 -9 9 2 9 -5 1 4 -4 1 8 2 1 -1 8 1 6 -9 2 -1 7 1 -8 7 1 -6 7 1 -6 -4 1 4 8 1 -9 8 2 -7 -8 1...
output:
3
result:
ok single line: '3'
Test #12:
score: 0
Accepted
time: 38ms
memory: 3824kb
input:
200000 1 -9 868328714 1 -2 169338841 2 -3 522935877 7 4 846334853 6 3 95747102 2 8 683463453 -3 10 674070722 7 5 879124379 9 7 411799557 -6 5 452823389 10 0 460945667 -5 -10 384988883 -4 10 944711005 -8 -6 540403661 6 0 804621844 -5 9 121613673 10 -3 854883852 7 -5 776415902 0 9 555825703 -6 -5 2637...
output:
49548
result:
ok single line: '49548'
Test #13:
score: 0
Accepted
time: 176ms
memory: 21460kb
input:
200000 -712994576 681957216 1 742214757 -749366118 1 643431902 -900788690 1 490499102 469176533 1 274934881 224980485 1 66532381 -860911586 1 776002355 -154470536 1 837312330 -571543374 1 971536663 -630853477 1 116903881 442223660 1 667716471 -828182152 1 336272958 -251409255 1 503068146 763971728 1...
output:
3
result:
ok single line: '3'
Test #14:
score: 0
Accepted
time: 183ms
memory: 21480kb
input:
200000 -602008984 693387889 1 897189880 -803134494 1 35887395 374199573 1 97436871 -310842124 2 -317640064 -574779803 1 -295972377 43817547 2 340192254 370024590 1 -78314559 -497366938 2 664758677 345537889 2 -631188522 -421590323 2 916801468 87978323 2 -392373838 89334600 1 993337752 798186512 2 -6...
output:
3
result:
ok single line: '3'
Test #15:
score: 0
Accepted
time: 183ms
memory: 20892kb
input:
200000 624731001 -756312895 732418025 -723028405 454048115 884229821 657008140 -126241037 451702065 -299325474 365545215 62086888 694524222 901018738 927667060 -806668501 548329101 564050553 162465309 -226915270 370979883 357761925 4184566 129493846 718751910 -547636756 397742261 -413240751 -9747541...
output:
31001
result:
ok single line: '31001'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
1 0 0 1
output:
-1
result:
ok single line: '-1'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
1 1 0 2
output:
-1
result:
ok single line: '-1'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
1 0 -1 463167712
output:
-1
result:
ok single line: '-1'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
1 0 -2 1
output:
-1
result:
ok single line: '-1'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
1 0 -1 2
output:
-1
result:
ok single line: '-1'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
1 1 0 918809706
output:
-1
result:
ok single line: '-1'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
1 0 -1 1
output:
-1
result:
ok single line: '-1'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
1 3 1 1
output:
-1
result:
ok single line: '-1'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
1 -3 3 104127434
output:
-1
result:
ok single line: '-1'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
1 -8 5 1
output:
-1
result:
ok single line: '-1'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
1 5 -9 2
output:
-1
result:
ok single line: '-1'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
1 -7 7 716743621
output:
-1
result:
ok single line: '-1'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
1 357462890 848080022 1
output:
-1
result:
ok single line: '-1'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1 887520827 -701989688 2
output:
-1
result:
ok single line: '-1'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 -170868300 -940219117 849841157
output:
-1
result:
ok single line: '-1'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
2 1 0 1 1 0 1
output:
-1
result:
ok single line: '-1'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
2 -1 -1 2 0 1 2
output:
-1
result:
ok single line: '-1'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
2 0 0 913090376 -1 -1 541928148
output:
-1
result:
ok single line: '-1'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 -2 1 1 -1 -1 1
output:
-1
result:
ok single line: '-1'
Test #35:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
2 2 -2 2 2 0 1
output:
-1
result:
ok single line: '-1'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 0 -1 705463868 -2 1 130111370
output:
-1
result:
ok single line: '-1'
Test #37:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
2 0 -3 1 -3 2 1
output:
-1
result:
ok single line: '-1'
Test #38:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
2 -3 2 1 3 -2 1
output:
-1
result:
ok single line: '-1'
Test #39:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 2 2 122302093 -2 -2 828026820
output:
-1
result:
ok single line: '-1'
Test #40:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
2 -5 10 1 -5 2 1
output:
-1
result:
ok single line: '-1'
Test #41:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 1 -5 2 9 5 1
output:
-1
result:
ok single line: '-1'
Test #42:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
2 -10 -5 31542690 -5 3 129473093
output:
-1
result:
ok single line: '-1'
Test #43:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
2 266809570 381130972 1 -890632596 454834668 1
output:
-1
result:
ok single line: '-1'
Test #44:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
2 236002924 544226705 1 -8930666 633728962 1
output:
-1
result:
ok single line: '-1'
Test #45:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 -997831104 237273816 438836317 -754753844 -855592460 577498221
output:
-1
result:
ok single line: '-1'
Test #46:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
3 1 -1 1 -1 -1 1 0 1 1
output:
3
result:
ok single line: '3'
Test #47:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
3 0 1 1 0 0 1 1 -1 2
output:
-1
result:
ok single line: '-1'
Test #48:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
3 1 1 364170638 0 1 112013377 -1 0 644196224
output:
-1
result:
ok single line: '-1'
Test #49:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
3 2 -1 1 2 0 1 1 -2 1
output:
-1
result:
ok single line: '-1'
Test #50:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
3 -2 -1 2 1 -2 2 -2 0 2
output:
-1
result:
ok single line: '-1'
Test #51:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
3 1 -1 367635035 0 -1 501995671 1 0 122350696
output:
-1
result:
ok single line: '-1'
Test #52:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
3 3 3 1 -3 -2 1 3 2 1
output:
-1
result:
ok single line: '-1'
Test #53:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
3 -1 -2 2 -1 0 2 1 3 1
output:
-1
result:
ok single line: '-1'
Test #54:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
3 2 -1 871260078 0 0 48868055 -2 3 678301346
output:
-1
result:
ok single line: '-1'
Test #55:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
3 -6 -4 1 -9 -3 1 2 -7 1
output:
-1
result:
ok single line: '-1'
Test #56:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
3 -4 9 1 -2 -5 1 -10 -5 1
output:
-1
result:
ok single line: '-1'
Test #57:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
3 -7 -7 869722287 3 4 494803269 1 -1 992571956
output:
2357097512
result:
ok single line: '2357097512'
Test #58:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
3 -289202947 -933105008 1 854736853 695493895 1 -839793012 321062172 1
output:
3
result:
ok single line: '3'
Test #59:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
3 -997919395 -44651903 2 -575930672 881718329 1 10157454 -725678725 2
output:
-1
result:
ok single line: '-1'
Test #60:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
3 -153974995 -733280733 18571221 -700358990 851291676 383127291 -97978411 -351707387 499070162
output:
-1
result:
ok single line: '-1'
Test #61:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
4 1 0 1 1 1 1 -1 1 1 0 0 1
output:
-1
result:
ok single line: '-1'
Test #62:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
4 1 -1 1 0 1 1 0 -1 1 1 1 2
output:
-1
result:
ok single line: '-1'
Test #63:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
4 1 0 424912797 1 1 20014826 -1 1 236445860 -1 0 945826160
output:
-1
result:
ok single line: '-1'
Test #64:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
4 0 -1 1 0 2 1 -1 -1 1 2 1 1
output:
3
result:
ok single line: '3'
Test #65:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
4 -2 2 2 1 1 2 0 0 2 1 1 1
output:
-1
result:
ok single line: '-1'
Test #66:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
4 -1 0 876759264 2 -1 829927108 1 0 639182840 2 -1 873348938
output:
-1
result:
ok single line: '-1'
Test #67:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
4 -1 3 1 0 -3 1 0 0 1 -2 0 1
output:
-1
result:
ok single line: '-1'
Test #68:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
4 2 3 2 3 2 1 -3 -2 1 0 -2 2
output:
5
result:
ok single line: '5'
Test #69:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
4 -1 1 479709005 0 0 629128474 -1 -2 401828193 1 -3 859823602
output:
-1
result:
ok single line: '-1'
Test #70:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
4 -10 3 1 5 3 1 -8 -4 1 -4 4 1
output:
-1
result:
ok single line: '-1'
Test #71:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
4 8 10 2 9 7 2 8 -7 2 -8 3 2
output:
6
result:
ok single line: '6'
Test #72:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
4 -9 -10 981747466 -2 5 628608354 -6 -3 507929909 3 -5 357833106
output:
1494371369
result:
ok single line: '1494371369'
Test #73:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
4 40409828 -930958911 1 -306359436 -568724956 1 -381156596 909241901 1 -515918651 -353432539 1
output:
-1
result:
ok single line: '-1'
Test #74:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
4 57108381 -484752235 2 -669727261 -84683717 1 -753877938 -825438490 2 -542675079 289658193 2
output:
-1
result:
ok single line: '-1'
Test #75:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
4 137296340 112516375 713084296 -848344371 240288422 940588554 161989482 -447300590 247982323 -190935573 -60214699 103730734
output:
1064797353
result:
ok single line: '1064797353'
Test #76:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
5 0 -1 1 -1 1 1 -1 -1 1 0 -1 1 0 0 1
output:
-1
result:
ok single line: '-1'
Test #77:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
5 0 0 1 0 1 2 1 1 2 0 -1 1 1 0 2
output:
-1
result:
ok single line: '-1'
Test #78:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
5 1 1 909578372 -1 -1 797960423 0 0 919126291 -1 -1 984885911 0 0 467926433
output:
-1
result:
ok single line: '-1'
Test #79:
score: -100
Wrong Answer
time: 0ms
memory: 3560kb
input:
5 2 0 1 2 -1 1 2 0 1 1 -1 1 -2 -2 1
output:
2
result:
wrong answer 1st lines differ - expected: '-1', found: '2'