| Task: | Platformer |
| Sender: | Przemyslaw Uznanski |
| Submission time: | 2015-09-16 17:55:17 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.06 s | details |
| #2 | ACCEPTED | 0.07 s | details |
| #3 | ACCEPTED | 0.07 s | details |
| #4 | ACCEPTED | 0.07 s | details |
| #5 | ACCEPTED | 0.07 s | details |
| #6 | ACCEPTED | 0.07 s | details |
| #7 | ACCEPTED | 0.06 s | details |
| #8 | ACCEPTED | 0.06 s | details |
| #9 | ACCEPTED | 0.06 s | details |
| #10 | ACCEPTED | 0.06 s | details |
| #11 | ACCEPTED | 0.07 s | details |
| #12 | ACCEPTED | 0.07 s | details |
| #13 | ACCEPTED | 0.07 s | details |
| #14 | ACCEPTED | 0.07 s | details |
| #15 | ACCEPTED | 0.07 s | details |
| #16 | ACCEPTED | 0.07 s | details |
| #17 | ACCEPTED | 0.05 s | details |
| #18 | ACCEPTED | 0.08 s | details |
| #19 | ACCEPTED | 0.06 s | details |
| #20 | ACCEPTED | 0.07 s | details |
| #21 | ACCEPTED | 0.06 s | details |
| #22 | ACCEPTED | 0.06 s | details |
| #23 | ACCEPTED | 0.07 s | details |
| #24 | ACCEPTED | 0.06 s | details |
| #25 | ACCEPTED | 0.05 s | details |
| #26 | ACCEPTED | 0.07 s | details |
| #27 | ACCEPTED | 0.06 s | details |
| #28 | ACCEPTED | 0.06 s | details |
| #29 | ACCEPTED | 0.07 s | details |
| #30 | ACCEPTED | 0.07 s | details |
| #31 | ACCEPTED | 0.06 s | details |
| #32 | ACCEPTED | 0.09 s | details |
| #33 | ACCEPTED | 0.09 s | details |
| #34 | ACCEPTED | 0.08 s | details |
| #35 | ACCEPTED | 0.10 s | details |
| #36 | ACCEPTED | 0.08 s | details |
| #37 | ACCEPTED | 0.09 s | details |
| #38 | ACCEPTED | 0.09 s | details |
| #39 | ACCEPTED | 0.09 s | details |
| #40 | ACCEPTED | 0.10 s | details |
| #41 | ACCEPTED | 0.10 s | details |
| #42 | ACCEPTED | 0.08 s | details |
| #43 | ACCEPTED | 0.09 s | details |
| #44 | ACCEPTED | 0.08 s | details |
| #45 | ACCEPTED | 0.10 s | details |
| #46 | ACCEPTED | 0.11 s | details |
| #47 | ACCEPTED | 0.09 s | details |
| #48 | ACCEPTED | 0.09 s | details |
| #49 | ACCEPTED | 0.08 s | details |
| #50 | ACCEPTED | 0.08 s | details |
| #51 | ACCEPTED | 0.09 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:23:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d%d",&n,&q,&w,&k);
^
input/code.cpp:34:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&t);
^
input/code.cpp:39:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&x,&e);
^Code
#include <cstdio>
#include <queue>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdlib>
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define x1 first
#define x2 second.first
#define x3 second.second
#define trip(a,b,c) mp(a,mp(b,c))
using namespace std;
const int inf = 1000000007;
int main()
{
int n,q,w,k;
scanf("%d%d%d%d",&n,&q,&w,&k);
set<pair<int,int> > S;
S.insert(mp(q,w));
int mycost = -k;
for(int i=0;i<n;i++)
{
mycost += k;
// printf("%d cost = %d\n",i,mycost);
int t;
scanf("%d",&t);
if(t==0)
continue;
int x,e;
scanf("%d%d",&x,&e);
set<pair<int,int> >::iterator fff;
int upper=-inf;
for(;;)
{
// puts("a");
fff = S.lower_bound(mp(x,-inf));
if(fff==S.end())
break;
if(fff->second - abs(fff->first - x) >= mycost)
{
upper = fff->second - abs(fff->first - x);
break;
}
if(fff->second > mycost)
break;
S.erase(fff);
}
int lower=-inf;
for(;;)
{
// puts("b");
fff = S.lower_bound(mp(x,-inf));
if(fff==S.begin())
break;
fff--;
if(fff->second - abs(fff->first - x) >= mycost)
{
lower = fff->second - abs(fff->first - x);
break;
}
if(fff->second > mycost)
break;
S.erase(fff);
}
int tmp = max(lower,upper);
if(tmp < 0)
{
continue;
}
tmp += e;
fff = S.lower_bound(mp(x,-inf));
if(fff!=S.end() && fff->first == x)
{
S.erase(fff);
}
S.insert(mp(x,tmp));
for(;;)
{
// puts("c");
set<pair<int,int> >::iterator ggg;
ggg = S.find(mp(x,tmp));
ggg++;
if(ggg==S.end())
break;
if(abs(ggg->first - x) + ggg->second < tmp)
S.erase(ggg);
else
break;
}
for(;;)
{
// puts("d");
set<pair<int,int> >::iterator ggg;
ggg = S.find(mp(x,tmp));
if(ggg==S.begin())
break;
ggg--;
if(abs(ggg->first - x) + ggg->second < tmp)
S.erase(ggg);
else
break;
}
// for(fff=S.begin();fff!=S.end();fff++)
// {
// printf("%d %d\n",fff->first, fff->second);
// }
}
for(set<pair<int,int> >::iterator fff=S.begin();fff!=S.end();fff++)
if(fff->second >= mycost)
{
puts("10-4");
return 0;
}
puts("QAQ");
}
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 93720 39133 271745 8828 0 1 35503 41358 0 0 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 97192 56015 123131 3873 1 83352 32477 1 94775 7864 0 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 99108 94600 113316 4855 0 0 0 0 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 94908 98153 200335 9390 0 1 97222 4762 1 92494 69700 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 5
Verdict: ACCEPTED
| input |
|---|
| 97925 19788 254413 9008 1 50423 68974 0 0 1 90601 12470 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 6
Verdict: ACCEPTED
| input |
|---|
| 90769 94368 226055 9254 1 6188 38889 0 0 1 15760 61611 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 7
Verdict: ACCEPTED
| input |
|---|
| 93010 53265 141409 6629 1 69399 59938 0 0 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 8
Verdict: ACCEPTED
| input |
|---|
| 94604 86622 3197 291 1 33740 246144103 1 14472 413062285 1 21305 728358221 1 97273 666356704 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 9
Verdict: ACCEPTED
| input |
|---|
| 90370 12656 203687 7741 0 1 20615 4965 0 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 10
Verdict: ACCEPTED
| input |
|---|
| 92711 1731 84200 9537 1 22362 44030 0 1 73954 148394 1 58582 92246 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 11
Verdict: ACCEPTED
| input |
|---|
| 97776 25155 104115 3949 1 68851 39872 1 23281 27180 0 0 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 12
Verdict: ACCEPTED
| input |
|---|
| 94285 13824 213256 6473 1 19089 7129 1 91649 15534 0 1 84631 18708 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 13
Verdict: ACCEPTED
| input |
|---|
| 97129 78853 3211 934 1 83665 499047841 0 0 0 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 14
Verdict: ACCEPTED
| input |
|---|
| 97992 37208 81257 9418 0 0 1 16726 18007 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 15
Verdict: ACCEPTED
| input |
|---|
| 91420 4824 115989 9403 0 1 77876 68096 1 42186 46525 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 16
Verdict: ACCEPTED
| input |
|---|
| 96179 90979 49680 2890 0 0 0 1 62847 45363 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 17
Verdict: ACCEPTED
| input |
|---|
| 95647 17291 19818 1740 1 61265 234051494 0 0 1 9322 35801 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 18
Verdict: ACCEPTED
| input |
|---|
| 98835 73849 160991 5151 1 3346 15560 1 42345 51204 0 1 71893 3785 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 19
Verdict: ACCEPTED
| input |
|---|
| 91256 48792 152543 5308 1 99803 46272 0 1 65300 39202 1 83359 39980 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 20
Verdict: ACCEPTED
| input |
|---|
| 98178 44514 183313 7966 0 0 0 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 21
Verdict: ACCEPTED
| input |
|---|
| 90142 20281 154074 8583 0 0 0 1 65682 10123 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 22
Verdict: ACCEPTED
| input |
|---|
| 99508 50312 28005 1483 1 8698 561100463 1 27518 17753 1 35183 6874 1 51423 709 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 23
Verdict: ACCEPTED
| input |
|---|
| 93572 52286 10683 5994 0 1 44635 143939594 1 98077 274789312 1 29936 101782377 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 24
Verdict: ACCEPTED
| input |
|---|
| 99507 16701 226527 9776 1 6848 34903 0 1 84638 50801 1 91779 82623 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 25
Verdict: ACCEPTED
| input |
|---|
| 93687 91600 174 117 0 1 72495 527049261 0 1 61437 169018252 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 26
Verdict: ACCEPTED
| input |
|---|
| 92181 11937 165368 5326 1 93556 16607 1 63375 639 0 1 34722 2656 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 27
Verdict: ACCEPTED
| input |
|---|
| 99053 16063 75605 6270 0 0 1 25114 124515 1 7349 30745 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 28
Verdict: ACCEPTED
| input |
|---|
| 91912 80570 12959 635 0 1 58320 237459984 1 47571 169756497 1 34391 329136180 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 29
Verdict: ACCEPTED
| input |
|---|
| 97096 15695 104773 5067 0 1 57538 26420 1 17419 65054 1 55286 49658 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 30
Verdict: ACCEPTED
| input |
|---|
| 94271 93605 53716 7282 0 0 0 1 63342 63872 ... |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 31
Verdict: ACCEPTED
| input |
|---|
| 10 48792 152543 5308 0 0 0 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 32
Verdict: ACCEPTED
| input |
|---|
| 97186 68207 36491 1 1 62847 1015 1 10662 424705944 1 63603 31508 1 93933 31123 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 33
Verdict: ACCEPTED
| input |
|---|
| 98824 51796 60765 1 1 57459 6393 1 81114 11603 0 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 34
Verdict: ACCEPTED
| input |
|---|
| 99707 79141 24396 1 1 15305 787266981 1 40625 325204064 1 71642 27545 1 11143 519121854 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 35
Verdict: ACCEPTED
| input |
|---|
| 99499 66563 10726 1 0 1 50930 4917259 1 89683 362392181 1 56945 6604 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 36
Verdict: ACCEPTED
| input |
|---|
| 96474 74211 32506 2 1 23133 265260726 0 1 55091 111891 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 37
Verdict: ACCEPTED
| input |
|---|
| 98892 62723 24829 1 1 91722 519273406 1 37709 465156425 1 94342 847977954 1 58182 9236 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 38
Verdict: ACCEPTED
| input |
|---|
| 95020 50407 58686 2 1 98541 88094 1 99994 29336 0 1 68064 24948 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 39
Verdict: ACCEPTED
| input |
|---|
| 99678 16584 44706 1 1 9935 1157 1 61471 809296994 1 25220 24675 1 43197 21080 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 40
Verdict: ACCEPTED
| input |
|---|
| 97562 3891 116896 2 1 5550 10290 1 3235 2632 1 92484 60120 1 42302 23320 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 41
Verdict: ACCEPTED
| input |
|---|
| 95382 38603 53680 2 0 1 73212 43790 1 9191 11570 1 15853 77057 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 42
Verdict: ACCEPTED
| input |
|---|
| 98321 68338 7247 1 0 1 70810 476 1 12697 537286430 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 43
Verdict: ACCEPTED
| input |
|---|
| 96622 16601 3959 1 1 31931 888513681 1 90381 431318803 1 9327 433232402 1 97464 149691554 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 44
Verdict: ACCEPTED
| input |
|---|
| 98097 3823 31380 1 1 49745 170502842 1 24743 4541 1 37009 145 1 1903 776 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 45
Verdict: ACCEPTED
| input |
|---|
| 96353 99694 19331 2 1 6141 280627823 1 5938 685091507 0 1 75645 36271308 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 46
Verdict: ACCEPTED
| input |
|---|
| 96566 6661 63261 1 1 52321 3509 1 28252 1429 0 1 36092 1839 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 47
Verdict: ACCEPTED
| input |
|---|
| 97998 25315 9841 2 0 1 81801 398177857 0 1 60076 10826582 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 48
Verdict: ACCEPTED
| input |
|---|
| 98709 93527 29589 1 0 1 40439 472607569 1 24151 449756851 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 49
Verdict: ACCEPTED
| input |
|---|
| 98681 12780 1379 1 0 0 1 52013 938639644 1 5933 109004048 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 50
Verdict: ACCEPTED
| input |
|---|
| 96889 34349 15648 1 1 41768 2294 1 85676 615774769 1 97093 519801205 0 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
Test 51
Verdict: ACCEPTED
| input |
|---|
| 95849 18797 40401 1 1 7503 649 0 0 1 56595 347 ... |
| correct output |
|---|
| 10-4 |
| user output |
|---|
| 10-4 |
