QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#254129 | #7680. Subway | ucup-team134# | AC ✓ | 2ms | 3808kb | C++17 | 4.5kb | 2023-11-18 01:25:20 | 2023-11-18 01:25:21 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define ll long long
#define pb push_back
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ld long double
#define li __int128
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<int D, typename T>struct vec : public vector<vec<D - 1, T>> {template<typename... Args>vec(int n = 0, Args... args) : vector<vec<D - 1, T>>(n, vec<D - 1, T>(args...)) {}};
template<typename T>struct vec<1, T> : public vector<T> {vec(int n = 0, T val = T()) : vector<T>(n, val) {}};
template<class T1,class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a){os << '{';for(int i=0;i<sz(a);i++){if(i>0&&i<sz(a))os << ", ";os << a[i];}os<<'}';return os;}
template<class T> ostream& operator<<(ostream& os, const deque<T>& a){os << '{';for(int i=0;i<sz(a);i++){if(i>0&&i<sz(a))os << ", ";os << a[i];}os<<'}';return os;}
template<class T> ostream& operator<<(ostream& os, const set<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T> ostream& operator<<(ostream& os, const set<T,greater<T> >& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T> ostream& operator<<(ostream& os, const multiset<T>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T> ostream& operator<<(ostream& os, const multiset<T,greater<T> >& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
template<class T1,class T2> ostream& operator<<(ostream& os, const map<T1,T2>& a) {os << '{';int i=0;for(auto p:a){if(i>0&&i<sz(a))os << ", ";os << p;i++;}os << '}';return os;}
int ri(){int x;scanf("%i",&x);return x;}
void rd(int&x){scanf("%i",&x);}
void rd(long long&x){scanf("%lld",&x);}
void rd(double&x){scanf("%lf",&x);}
void rd(long double&x){scanf("%Lf",&x);}
void rd(string&x){cin>>x;}
void rd(char*x){scanf("%s",x);}
template<typename T1,typename T2>void rd(pair<T1,T2>&x){rd(x.first);rd(x.second);}
template<typename T>void rd(vector<T>&x){for(T&p:x)rd(p);}
template<typename C,typename...T>void rd(C&a,T&...args){rd(a);rd(args...);}
//istream& operator>>(istream& is,__int128& a){string s;is>>s;a=0;int i=0;bool neg=false;if(s[0]=='-')neg=true,i++;for(;i<s.size();i++)a=a*10+s[i]-'0';if(neg)a*=-1;return is;}
//ostream& operator<<(ostream& os,__int128 a){bool neg=false;if(a<0)neg=true,a*=-1;ll high=(a/(__int128)1e18);ll low=(a-(__int128)1e18*high);string res;if(neg)res+='-';if(high>0){res+=to_string(high);string temp=to_string(low);res+=string(18-temp.size(),'0');res+=temp;}else res+=to_string(low);os<<res;return os;}
int main()
{
int n=ri();
vector<pair<pair<int,int>,int>> ok;
int l=0;
for(int i=0;i<n;i++){
int x=ri(),y=ri(),a=ri();
ok.pb({{y,x},a});
l=max(l,a);
}
sort(all(ok));
int X=1e8;
int Y=-1001;
vector<vector<pair<int,int>>> lines(l);
vector<int> lastStation(l,-1);
vector<int> sty;
vector<int> stx;
for(int i=0;i<n;i++){
int x=ok[i].f.s,y=ok[i].f.f;
int a=ok[i].s;
sty.pb(Y-1);
int stX=X-1;
stx.pb(stX);
for(int j=0;j<a;j++){
int lind=j;
if(lastStation[lind]!=-1){ //jump!
if(lastStation[lind]==i-1){
lines[lind].pb({stx[i],sty[i]});
sty[i]--;
}
else{
int yy=0;
for(int k=i;k>lastStation[lind];k--){
yy=min(yy,sty[k]);
}
for(int k=i;k>lastStation[lind];k--){
sty[k]=yy-1;
}
lines[lind].pb({stx[lastStation[lind]+1],yy});
lines[lind].pb({stx[i],yy});
}
}
lines[lind].pb({X,Y});
lines[lind].pb({x,y});
X+=2;
}
for(int j=0;j<a;j++){
int lind=a-j-1;
lines[lind].pb({X,Y});
X+=2;
lastStation[lind]=i;
}
}
printf("%i\n",l);
for(int i=0;i<l;i++){
printf("%i",sz(lines[i]));
for(auto p:lines[i])printf(" %i %i",p.f,p.s);
printf("\n");
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3616kb
input:
3 1 2 1 2 1 2 3 3 2
output:
2 11 100000000 -1001 2 1 100000006 -1001 100000007 -1002 100000008 -1001 1 2 100000010 -1001 100000011 -1002 100000012 -1001 3 3 100000018 -1001 8 100000002 -1001 2 1 100000004 -1001 100000007 -1003 100000011 -1003 100000014 -1001 3 3 100000016 -1001
result:
ok ok Sum L = 19
Test #2:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
1 1 1 1
output:
1 3 100000000 -1001 1 1 100000002 -1001
result:
ok ok Sum L = 3
Test #3:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
1 1 1 50
output:
50 3 100000000 -1001 1 1 100000198 -1001 3 100000002 -1001 1 1 100000196 -1001 3 100000004 -1001 1 1 100000194 -1001 3 100000006 -1001 1 1 100000192 -1001 3 100000008 -1001 1 1 100000190 -1001 3 100000010 -1001 1 1 100000188 -1001 3 100000012 -1001 1 1 100000186 -1001 3 100000014 -1001 1 1 100000184...
result:
ok ok Sum L = 150
Test #4:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
50 662 -567 48 728 -120 7 307 669 27 -885 -775 21 100 242 9 -784 -537 41 940 198 46 736 -551 30 -449 456 16 -945 382 18 -182 810 49 213 187 44 853 245 48 617 -305 19 -81 261 3 617 208 8 -548 -652 6 -888 -667 14 -371 -812 43 202 -702 10 -668 -725 5 961 -919 33 -870 -697 50 428 810 29 560 405 7 348 -3...
output:
50 199 100000000 -1001 961 -919 100000130 -1001 100000131 -1002 100000132 -1001 -306 -897 100000302 -1001 100000303 -1002 100000304 -1001 334 -893 100000334 -1001 100000335 -1002 100000336 -1001 -371 -812 100000506 -1001 100000507 -1002 100000508 -1001 -885 -775 100000590 -1001 100000591 -1002 10000...
result:
ok ok Sum L = 5186
Test #5:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
50 -772 697 1 -756 -909 1 659 923 1 850 471 1 260 -24 1 473 -639 1 -575 393 1 -466 197 1 333 -637 1 -192 -890 1 103 546 1 749 -723 1 -573 613 1 214 -138 1 277 928 1 266 291 1 911 275 1 -680 -67 1 69 190 1 -197 -795 1 684 618 1 729 -115 1 -658 -229 1 -595 -470 1 898 -172 1 401 81 1 133 685 1 223 400 ...
output:
1 199 100000000 -1001 -162 -959 100000002 -1001 100000003 -1002 100000004 -1001 -756 -909 100000006 -1001 100000007 -1002 100000008 -1001 -192 -890 100000010 -1001 100000011 -1002 100000012 -1001 30 -869 100000014 -1001 100000015 -1002 100000016 -1001 -197 -795 100000018 -1001 100000019 -1002 100000...
result:
ok ok Sum L = 199
Test #6:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
50 -56 747 3 993 -490 4 930 -139 1 -298 -330 1 938 -351 5 -973 100 5 -472 44 4 345 628 5 481 -91 4 789 581 5 457 -29 4 871 -799 1 692 994 4 699 854 2 893 -33 1 -483 256 3 -962 -540 2 846 -893 1 830 609 5 845 -383 2 -552 -966 1 -544 -51 1 564 186 4 -615 -675 1 618 -911 3 -561 -302 4 -293 667 3 -334 -...
output:
5 199 100000000 -1001 356 -986 100000014 -1001 100000015 -1002 100000016 -1001 348 -975 100000030 -1001 100000031 -1002 100000032 -1001 -552 -966 100000034 -1001 100000035 -1002 100000036 -1001 618 -911 100000046 -1001 100000047 -1002 100000048 -1001 846 -893 100000050 -1001 100000051 -1002 10000005...
result:
ok ok Sum L = 601
Test #7:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
50 600 997 5 -893 -204 3 408 443 1 -560 -748 7 -647 161 6 -285 -980 1 87 -582 7 -48 -721 7 997 285 2 -189 -728 8 525 222 4 -324 816 9 760 317 3 753 -480 10 -813 -921 3 -325 -875 8 -747 816 10 -627 605 7 775 786 6 136 -54 2 274 948 10 216 -113 7 924 68 3 101 576 8 60 -501 2 898 801 8 -767 -974 10 -99...
output:
10 199 100000000 -1001 -313 -996 100000014 -1001 100000015 -1002 100000016 -1001 -285 -980 100000018 -1001 100000019 -1002 100000020 -1001 -767 -974 100000058 -1001 100000059 -1002 100000060 -1001 932 -941 100000070 -1001 100000071 -1002 100000072 -1001 -258 -938 100000094 -1001 100000095 -1002 1000...
result:
ok ok Sum L = 1180
Test #8:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
50 24 -889 49 117 418 49 25 524 44 980 -416 43 -494 357 41 -287 -285 46 151 574 41 -289 68 49 -515 -540 41 -367 -178 47 -887 151 45 197 -272 47 714 724 45 -737 94 49 810 830 47 808 -695 41 537 -637 49 -142 -167 44 -749 -631 47 445 -444 42 801 910 43 59 363 42 -912 466 50 -649 -479 48 -958 -511 49 88...
output:
50 199 100000000 -1001 75 -958 100000194 -1001 100000195 -1002 100000196 -1001 -282 -917 100000374 -1001 100000375 -1002 100000376 -1001 24 -889 100000570 -1001 100000571 -1002 100000572 -1001 173 -857 100000742 -1001 100000743 -1002 100000744 -1001 273 -830 100000926 -1001 100000927 -1002 100000928...
result:
ok ok Sum L = 9101
Test #9:
score: 0
Accepted
time: 2ms
memory: 3804kb
input:
50 151 -171 50 -367 -951 50 808 569 50 150 -618 50 27 -476 50 -846 729 50 549 -456 50 50 646 50 294 -70 50 -571 104 50 128 -265 50 913 -700 50 267 -965 50 896 846 50 -2 713 50 21 679 50 -515 975 50 168 180 50 -369 -98 50 676 115 50 643 -779 50 920 -237 50 -324 450 50 149 -378 50 -882 -602 50 -126 -7...
output:
50 199 100000000 -1001 -302 -989 100000198 -1001 100000199 -1002 100000200 -1001 267 -965 100000398 -1001 100000399 -1002 100000400 -1001 -367 -951 100000598 -1001 100000599 -1002 100000600 -1001 417 -944 100000798 -1001 100000799 -1002 100000800 -1001 197 -923 100000998 -1001 100000999 -1002 100001...
result:
ok ok Sum L = 9950
Test #10:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
50 4 5 34 1 -5 24 -4 -4 32 -3 3 28 0 -1 21 1 -4 25 0 0 30 0 -4 42 -3 -2 44 -5 -3 37 4 -1 46 5 2 20 2 2 37 -2 5 35 -2 -1 39 2 4 32 -4 -3 42 0 3 32 3 5 47 -4 1 2 5 -1 17 -5 -4 5 -2 2 29 -5 1 11 2 -5 43 4 4 14 -5 0 9 0 -5 17 5 1 27 -3 0 24 -1 4 16 5 0 50 3 -2 18 1 -2 6 2 -1 29 -1 3 38 1 5 36 -3 1 28 -3...
output:
50 199 100000000 -1001 -2 -5 100000182 -1001 100000183 -1002 100000184 -1001 0 -5 100000250 -1001 100000251 -1002 100000252 -1001 1 -5 100000346 -1001 100000347 -1002 100000348 -1001 2 -5 100000518 -1001 100000519 -1002 100000520 -1001 -5 -4 100000538 -1001 100000539 -1002 100000540 -1001 -4 -4 1000...
result:
ok ok Sum L = 6025
Test #11:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
50 2 0 2 2 -3 2 4 1 2 -3 -3 2 -5 1 2 5 3 2 -5 -3 2 -3 -2 2 2 -1 2 2 3 2 4 4 1 1 -4 1 5 -1 2 -4 1 2 3 -2 1 -1 2 2 5 -5 2 -2 1 2 -5 -1 2 -2 -1 2 -1 -2 2 5 5 1 0 -2 2 1 1 1 2 2 2 3 5 2 -2 -4 1 -3 5 1 4 2 2 -4 -4 2 -3 2 1 5 0 2 -2 -2 2 -4 4 1 -2 5 2 2 5 1 3 -5 2 -4 5 2 -5 5 2 -2 4 2 -5 -5 2 -2 2 2 -3 -4...
output:
2 199 100000000 -1001 -5 -5 100000006 -1001 100000007 -1002 100000008 -1001 3 -5 100000014 -1001 100000015 -1002 100000016 -1001 5 -5 100000022 -1001 100000023 -1002 100000024 -1001 -4 -4 100000030 -1001 100000031 -1002 100000032 -1001 -3 -4 100000038 -1001 100000039 -1002 100000040 -1001 -2 -4 1000...
result:
ok ok Sum L = 351
Test #12:
score: 0
Accepted
time: 2ms
memory: 3800kb
input:
50 4 3 49 -5 -3 49 0 -3 50 -2 -4 49 -5 -5 50 4 0 49 -1 -2 49 -2 0 49 1 2 50 -1 -5 50 -5 -1 50 -5 5 49 2 0 50 -2 -3 50 -4 -5 50 0 -2 50 -5 4 50 -1 1 49 -1 -4 49 -3 -1 49 1 -3 50 -4 1 50 0 5 50 1 -2 50 -1 5 50 4 2 50 4 -3 49 1 -4 49 -1 -1 49 -3 -5 50 4 -4 50 3 2 49 3 -3 49 0 2 50 -3 -4 49 5 -1 49 -3 5...
output:
50 199 100000000 -1001 -5 -5 100000198 -1001 100000199 -1002 100000200 -1001 -4 -5 100000398 -1001 100000399 -1002 100000400 -1001 -3 -5 100000598 -1001 100000599 -1002 100000600 -1001 -1 -5 100000798 -1001 100000799 -1002 100000800 -1001 1 -5 100000994 -1001 100000995 -1002 100000996 -1001 2 -5 100...
result:
ok ok Sum L = 9870
Test #13:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
50 114 514 30 115 514 41 116 514 6 117 514 49 118 514 10 119 514 49 120 514 1 121 514 7 122 514 3 123 514 4 124 514 1 125 514 12 126 514 15 127 514 16 128 514 34 129 514 24 130 514 49 131 514 43 132 514 25 133 514 12 134 514 26 135 514 13 136 514 12 137 514 15 138 514 7 139 514 25 140 514 5 141 514 ...
output:
49 199 100000000 -1001 114 514 100000118 -1001 100000119 -1002 100000120 -1001 115 514 100000282 -1001 100000283 -1002 100000284 -1001 116 514 100000306 -1001 100000307 -1002 100000308 -1001 117 514 100000502 -1001 100000503 -1002 100000504 -1001 118 514 100000542 -1001 100000543 -1002 100000544 -10...
result:
ok ok Sum L = 4901
Test #14:
score: 0
Accepted
time: 1ms
memory: 3792kb
input:
50 191 981 19 191 980 41 191 979 20 191 978 14 191 977 2 191 976 49 191 975 40 191 974 3 191 973 20 191 972 6 191 971 13 191 970 4 191 969 4 191 968 47 191 967 32 191 966 11 191 965 34 191 964 30 191 963 3 191 962 16 191 961 24 191 960 30 191 959 34 191 958 31 191 957 24 191 956 29 191 955 42 191 95...
output:
49 199 100000000 -1001 191 932 100000086 -1001 100000087 -1002 100000088 -1001 191 933 100000222 -1001 100000223 -1002 100000224 -1001 191 934 100000298 -1001 100000299 -1002 100000300 -1001 191 935 100000354 -1001 100000355 -1002 100000356 -1001 191 936 100000418 -1001 100000419 -1002 100000420 -10...
result:
ok ok Sum L = 4934
Test #15:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
50 -123 456 47 -122 457 35 -121 458 25 -120 459 35 -119 460 30 -118 461 33 -117 462 21 -116 463 31 -115 464 21 -114 465 35 -113 466 20 -112 467 17 -111 468 25 -110 469 3 -109 470 29 -108 471 35 -107 472 4 -106 473 44 -105 474 4 -104 475 28 -103 476 49 -102 477 9 -101 478 39 -100 479 9 -99 480 21 -98...
output:
50 199 100000000 -1001 -123 456 100000186 -1001 100000187 -1002 100000188 -1001 -122 457 100000326 -1001 100000327 -1002 100000328 -1001 -121 458 100000426 -1001 100000427 -1002 100000428 -1001 -120 459 100000566 -1001 100000567 -1002 100000568 -1001 -119 460 100000686 -1001 100000687 -1002 10000068...
result:
ok ok Sum L = 5176
Test #16:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
50 321 -525 46 322 -526 14 323 -527 16 324 -528 38 325 -529 22 326 -530 24 327 -531 48 328 -532 5 329 -533 7 330 -534 30 331 -535 25 332 -536 2 333 -537 13 334 -538 1 335 -539 33 336 -540 8 337 -541 9 338 -542 2 339 -543 29 340 -544 17 341 -545 41 342 -546 39 343 -547 9 344 -548 47 345 -549 47 346 -...
output:
50 199 100000000 -1001 370 -574 100000146 -1001 100000147 -1002 100000148 -1001 369 -573 100000150 -1001 100000151 -1002 100000152 -1001 368 -572 100000294 -1001 100000295 -1002 100000296 -1001 367 -571 100000422 -1001 100000423 -1002 100000424 -1001 366 -570 100000446 -1001 100000447 -1002 10000044...
result:
ok ok Sum L = 5231
Test #17:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
50 -444 -555 23 -445 -556 32 -446 -557 36 -447 -558 29 -448 -559 4 -449 -560 25 -450 -561 29 -451 -562 5 -452 -563 9 -453 -564 28 -454 -565 35 -455 -566 26 -456 -567 22 -457 -568 39 -458 -569 13 -459 -570 50 -460 -571 37 -461 -572 14 -462 -573 26 -463 -574 49 -464 -575 23 -465 -576 44 -466 -577 2 -4...
output:
50 199 100000000 -1001 -493 -604 100000026 -1001 100000027 -1002 100000028 -1001 -492 -603 100000074 -1001 100000075 -1002 100000076 -1001 -491 -602 100000250 -1001 100000251 -1002 100000252 -1001 -490 -601 100000274 -1001 100000275 -1002 100000276 -1001 -489 -600 100000406 -1001 100000407 -1002 100...
result:
ok ok Sum L = 4991
Test #18:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
50 -142 0 48 -143 1 22 -144 2 45 -145 3 9 -146 4 36 -147 5 46 -148 6 26 -149 7 26 -150 8 9 -151 9 19 -152 10 22 -153 11 14 -154 12 8 -155 13 20 -156 14 41 -157 15 47 -158 16 22 -159 17 50 -160 18 3 -161 19 12 -162 20 15 -163 21 32 -164 22 46 -165 23 45 -166 24 3 -167 25 27 -168 26 33 -169 27 17 -170...
output:
50 199 100000000 -1001 -142 0 100000190 -1001 100000191 -1002 100000192 -1001 -143 1 100000278 -1001 100000279 -1002 100000280 -1001 -144 2 100000458 -1001 100000459 -1002 100000460 -1001 -145 3 100000494 -1001 100000495 -1002 100000496 -1001 -146 4 100000638 -1001 100000639 -1002 100000640 -1001 -1...
result:
ok ok Sum L = 5640
Test #19:
score: 0
Accepted
time: 1ms
memory: 3740kb
input:
12 1000 1000 50 1000 -1000 50 1000 999 50 999 1000 50 999 -1000 50 -999 1000 50 1000 -999 50 -999 -1000 50 -1000 1000 50 -1000 -1000 50 -1000 -999 50 -1000 999 50
output:
50 47 100000000 -1001 -1000 -1000 100000198 -1001 100000199 -1002 100000200 -1001 -999 -1000 100000398 -1001 100000399 -1002 100000400 -1001 999 -1000 100000598 -1001 100000599 -1002 100000600 -1001 1000 -1000 100000798 -1001 100000799 -1002 100000800 -1001 -1000 -999 100000998 -1001 100000999 -1002...
result:
ok ok Sum L = 2350
Test #20:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
4 1000 1000 50 1000 -1000 50 -1000 1000 50 -1000 -1000 50
output:
50 15 100000000 -1001 -1000 -1000 100000198 -1001 100000199 -1002 100000200 -1001 1000 -1000 100000398 -1001 100000399 -1002 100000400 -1001 -1000 1000 100000598 -1001 100000599 -1002 100000600 -1001 1000 1000 100000798 -1001 15 100000002 -1001 -1000 -1000 100000196 -1001 100000199 -1003 100000202 -...
result:
ok ok Sum L = 750
Extra Test:
score: 0
Extra Test Passed