QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#35661 | #4270. Double Attendance | p_b_p_b | 5 | 29ms | 41080kb | C++17 | 5.8kb | 2022-06-17 21:05:06 | 2022-06-17 21:05:07 |
Judging History
answer
#include<bits/stdc++.h>
namespace my_std{
using namespace std;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fir first
#define sec second
#define MP make_pair
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drep(i,x,y) for (int i=(x);i>=(y);i--)
#define go(x) for (int i=head[x];i;i=edge[i].nxt)
#define templ template<typename T>
#define sz 333333
typedef long long ll;
typedef double db;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
templ inline T rnd(T l,T r) {return uniform_int_distribution<T>(l,r)(rng);}
templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
templ inline void read(T& t)
{
t=0;char f=0,ch=getchar();double d=0.1;
while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
t=(f?-t:t);
}
template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
char __sr[1<<21],__z[20];int __C=-1,__zz=0;
inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
inline void print(int x)
{
if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
while(__z[++__zz]=x%10+48,x/=10);
while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
}
void file()
{
#ifdef NTFOrz
freopen("a.in","r",stdin);
#endif
}
inline void chktime()
{
#ifdef NTFOrz
cerr<<clock()/1000.0<<'\n';
#endif
}
#ifdef mod
ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
ll inv(ll x){return ksm(x,mod-2);}
#else
ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x) if (y&1) ret=ret*x;return ret;}
#endif
// inline ll mul(ll a,ll b){ll d=(ll)(a*(double)b/mod+0.5);ll ret=a*b-d*mod;if (ret<0) ret+=mod;return ret;}
}
using namespace my_std;
int n,m; ll K;
struct hh{ll l,r;bool operator < (const hh &a) const {return l<a.l;}}a[sz],b[sz];
int opA[sz],opB[sz];
int idA[sz][2],idB[sz][2],cc;
vector<pii>V[sz<<2];
int dp[sz<<2];
// x 属于哪个线段;如果哪个都不属于就往前走
int findA(ll x){int p=upper_bound(a+1,a+n+1,(hh){x,x})-a-1;if (p!=0&&a[p].r>=x) return p;return p+1;}
int findB(ll x){int p=upper_bound(b+1,b+m+1,(hh){x,x})-b-1;if (p!=0&&b[p].r>=x) return p;return p+1;}
int __CUR;
pll _tr[2][sz<<2];
#define tr _tr[__CUR]
#define ls k<<1
#define rs k<<1|1
#define lson ls,l,mid
#define rson rs,mid+1,r
void build(int k,int l,int r,hh *a)
{
if (l==r) return tr[k]=MP(a[l].l-2ll*K*l,a[l].r-2ll*K*l),void();
int mid=(l+r)>>1;
build(lson,a),build(rson,a);
tr[k]=MP(max(tr[ls].fir,tr[rs].fir),min(tr[ls].sec,tr[rs].sec));
}
int query(int k,int l,int r,int st,ll x)
{
if (r<st) return -1;
if (l==r) return x>=tr[k].fir&&x<=tr[k].sec?-1:l;
int mid=(l+r)>>1;
int res=query(lson,st,x);
if (res!=-1) return res;
return query(rson,st,x);
}
void work()
{
__CUR=0; build(1,1,n+1,a);
__CUR=1; build(1,1,m+1,b);
auto GO=[](int i,int j,int l,int r,int del,int c,ll x)
{
// cerr<<l<<' '<<r<<'\n';
rep(_,1,8) // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
// if (_>8)
// {
// cerr<<i<<' '<<j<<'\n';
// }
x+=K;
if (b[r].l>x||b[r].r<x)
{
r=findB(x);
if (b[r].l<x) c+=(r!=del),++r;
V[idA[i][j]].push_back(MP(idB[r][opB[r]==l],c+1));
break;
}
assert(r<=m);
V[idA[i][j]].push_back(MP(idB[r+1][opB[r+1]==l],c+(r!=del)+1));
c+=(r!=del); del=l;
++l;
x+=K;
if (a[l].l>x||a[l].r<x)
{
l=findA(x);
if (a[l].l<x) c+=(l!=del),++l;
V[idA[i][j]].push_back(MP(idA[l][opA[l]==r],c+1));
break;
}
assert(l<=n);
V[idA[i][j]].push_back(MP(idA[l+1][opA[l+1]==r],c+(l!=del)+1));
c+=(l!=del); del=r;
++r;
}
};
rep(i,1,n)
{
ll x=a[i].l;
int t=findB(x+K);
rep(j,0,1)
{
int l=i,r=t,del=(j?opA[i]:0),c=0;
GO(i,j,l,r,del,c,x);
}
// continue; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
__CUR=0; int af=query(1,1,n+1,i+1,x+2ll*K-2ll*(i+1)*K);
__CUR=1; int bf=query(1,1,m+1,t,x+K-2ll*t*K);
if (min(af-i-1,bf-t)<=6) continue;
rep(j,0,1)
{
int l=i,r=t,del=(j?opA[i]:0),c=(del!=t);
int k=min(af-i-1,bf-t)-3; l+=k,r+=k,c+=2*k-1,x+=2*k*K; del=r-1;
// cerr<<l<<' '<<r<<'\n';
GO(i,j,l,r,del,c,x);
}
}
}
void dijkstra()
{
static pii id[sz<<2]; int cc=0;
rep(i,1,n+1) rep(j,0,1) id[++cc]=MP(a[i].l,idA[i][j]);
rep(i,1,m+1) rep(j,0,1) id[++cc]=MP(b[i].l,idB[i][j]);
sort(id+1,id+cc+1);
static int pre[sz]; rep(i,1,cc) pre[id[i].sec]=i;
dp[idA[1][0]]=1;
rep(i,1,cc) for (auto p:V[id[i].sec])
{
chkmax(dp[p.fir],dp[id[i].sec]+p.sec);
if (i>=pre[p.fir])
{
puts("");
}
}
}
int main()
{
file();
read(n,m,K);
rep(i,1,n) read(a[i].l,a[i].r),--a[i].r;
rep(i,1,m) read(b[i].l,b[i].r),--b[i].r;
sort(a+1,a+n+1),sort(b+1,b+m+1);
int added=0;
if (a[1].l!=0) { added=1; ++n; drep(i,n,2) a[i]=a[i-1]; a[1]=hh{0,0}; }
a[n+1]=b[m+1]=hh{int(2e9)+1,int(2e9)+1};
rep(i,1,n+1) opA[i]=findB(a[i].l),opA[i]=((opA[i]!=-1&&b[opA[i]].l<=a[i].l)?opA[i]:m+i+1);
rep(i,1,m+1) opB[i]=findA(b[i].l),opB[i]=((opB[i]!=-1&&a[opB[i]].l<=b[i].l)?opB[i]:n+i+1);
rep(i,1,n+1) rep(j,0,1) idA[i][j]=++cc; rep(i,1,m+1) rep(j,0,1) idB[i][j]=++cc;
// 无脑往前走
rep(i,1,n) rep(j,0,1) V[idA[i][j]].push_back(MP(idA[i+1][j&&opA[i]==opA[i+1]],1));
rep(i,1,m) rep(j,0,1) V[idB[i][j]].push_back(MP(idB[i+1][j&&opB[i]==opB[i+1]],1));
// 向对面跳
work();
{
int _=max(n+1,m+1);
rep(i,1,_) swap(a[i],b[i]),swap(opA[i],opB[i]);
rep(i,1,_) rep(j,0,1) swap(idA[i][j],idB[i][j]);
swap(n,m);
}
work();
{
int _=max(n+1,m+1);
rep(i,1,_) swap(a[i],b[i]),swap(opA[i],opB[i]);
rep(i,1,_) rep(j,0,1) swap(idA[i][j],idB[i][j]);
swap(n,m);
}
dijkstra();
cout<<dp[idA[n+1][0]]-1-added;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 2ms
memory: 38492kb
input:
3 1 8 10 20 100 101 20 21 15 25
output:
3
result:
ok single line: '3'
Test #2:
score: 0
Accepted
time: 4ms
memory: 38212kb
input:
1 5 3 1 100 1 2 2 3 3 4 4 5 5 6
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 4ms
memory: 37752kb
input:
10 10 5 4 9 43 48 69 70 70 72 52 67 75 83 100 103 103 1501 10 27 28 40 5 7 27 29 30 39 40 42 42 45 67 80 0 5 45 59 10 20 22 23
output:
18
result:
ok single line: '18'
Test #4:
score: 0
Accepted
time: 3ms
memory: 37252kb
input:
1 1 1 0 1 0 1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 3ms
memory: 37540kb
input:
1 10 2 1 2000 4 5 10 11 7 8 3 4 9 10 1 2 2 3 8 9 6 7 5 6
output:
10
result:
ok single line: '10'
Test #6:
score: 0
Accepted
time: 6ms
memory: 37340kb
input:
10 10 90 1440 1620 0 180 1080 1260 900 1080 180 360 720 900 540 720 360 540 1620 1800 1260 1440 1170 1350 990 1170 1530 1710 1350 1530 90 270 450 630 270 450 630 810 810 990 1710 1890
output:
20
result:
ok single line: '20'
Test #7:
score: 0
Accepted
time: 8ms
memory: 38128kb
input:
10 10 90 1080 1260 1440 1620 900 1080 1620 1800 180 360 360 540 540 720 1800 1980 1260 1440 720 900 90 270 1710 1890 810 990 1170 1350 1530 1710 630 810 1350 1530 990 1170 450 630 270 450
output:
20
result:
ok single line: '20'
Test #8:
score: 0
Accepted
time: 2ms
memory: 38920kb
input:
10 10 166 1 2 664 996 332 664 1660 1992 0 1 1328 1660 996 1328 3 4 2 3 4 5 333 334 1494 1826 498 830 1162 1494 334 335 336 337 0 332 830 1162 335 336 332 333
output:
20
result:
ok single line: '20'
Test #9:
score: 0
Accepted
time: 10ms
memory: 37660kb
input:
10 10 166 2 3 0 1 3 4 1328 1660 1999 2000 996 1328 1 2 332 664 4 5 664 996 334 335 335 336 333 334 1162 1494 0 332 498 830 336 337 830 1162 332 333 1999 2000
output:
19
result:
ok single line: '19'
Test #10:
score: 0
Accepted
time: 4ms
memory: 38868kb
input:
10 10 1 1607 1721 327 413 222 264 1744 1746 35 50 619 766 995 1127 1421 1541 1236 1294 984 995 626 1122 1313 1386 65 141 1394 1428 1553 1764 1766 1990 1551 1552 465 531 1500 1531 623 625
output:
20
result:
ok single line: '20'
Test #11:
score: 0
Accepted
time: 4ms
memory: 37476kb
input:
10 10 1000000000 664 1247 157 183 1975 1986 1289 1374 1448 1461 233 326 1888 1913 183 194 1927 1933 1499 1672 1138 1387 402 652 266 396 1439 1452 1954 1956 684 737 1700 1887 1576 1678 1473 1485 886 1004
output:
10
result:
ok single line: '10'
Test #12:
score: 0
Accepted
time: 4ms
memory: 38644kb
input:
10 10 3 786 792 1395 1579 1348 1371 303 371 430 431 1331 1343 813 1050 1833 1853 654 706 622 634 237 302 1261 1266 49 216 1514 1524 1524 1607 1004 1018 748 918 1020 1141 1967 1994 1710 1735
output:
20
result:
ok single line: '20'
Test #13:
score: 0
Accepted
time: 3ms
memory: 38080kb
input:
10 10 4 82 206 370 769 1086 1131 267 330 836 984 995 1052 778 805 1880 1956 1956 1999 1531 1761 1687 1730 1879 1968 694 710 441 674 738 1302 1734 1737 1357 1365 1372 1604 1606 1672 722 726
output:
20
result:
ok single line: '20'
Test #14:
score: 0
Accepted
time: 8ms
memory: 38668kb
input:
10 10 9 1667 1724 266 375 1736 1936 1312 1659 858 886 442 708 193 198 1127 1244 383 428 935 1021 614 628 1797 1832 199 218 229 268 386 404 413 587 962 1248 814 878 1462 1732 1420 1424
output:
20
result:
ok single line: '20'
Test #15:
score: 0
Accepted
time: 8ms
memory: 37568kb
input:
10 10 16 14 88 1638 1644 645 970 1218 1232 1401 1589 1972 1994 1657 1721 1145 1188 1243 1246 179 244 1925 1958 355 433 706 832 564 587 12 270 1541 1728 1499 1529 294 348 1160 1205 1004 1032
output:
20
result:
ok single line: '20'
Test #16:
score: 0
Accepted
time: 4ms
memory: 37536kb
input:
10 10 64 998 1233 1868 1888 1898 1943 1811 1818 243 292 185 202 205 211 342 454 1269 1313 970 973 770 1192 1424 1435 710 715 60 74 77 250 1992 1998 715 758 1393 1397 1523 1695 359 439
output:
20
result:
ok single line: '20'
Test #17:
score: 0
Accepted
time: 3ms
memory: 38296kb
input:
10 10 31 1755 1831 1513 1514 559 565 1557 1727 1891 1997 56 159 527 544 1745 1749 572 1106 483 504 1789 1824 1306 1439 1680 1789 1490 1528 1089 1144 832 1010 18 306 813 820 598 757 1184 1229
output:
19
result:
ok single line: '19'
Test #18:
score: 0
Accepted
time: 2ms
memory: 37600kb
input:
10 10 995 1139 1304 1108 1135 1682 1771 1897 1913 244 404 1359 1362 1385 1608 420 496 787 1053 562 769 506 514 164 315 324 338 699 1240 1936 1957 634 695 385 454 20 107 525 621 1920 1931
output:
10
result:
ok single line: '10'
Test #19:
score: 0
Accepted
time: 0ms
memory: 38492kb
input:
10 10 1256 1757 1979 898 939 486 649 1074 1085 1346 1584 1201 1345 1013 1034 1070 1071 1109 1198 56 398 587 588 589 615 49 65 338 467 1201 1252 559 578 635 689 706 743 1495 1831 995 1043
output:
10
result:
ok single line: '10'
Test #20:
score: 0
Accepted
time: 4ms
memory: 38308kb
input:
10 10 1554 951 962 1902 1934 1220 1367 1499 1621 386 387 993 1127 536 813 1862 1893 526 532 401 431 1048 1050 986 990 609 645 793 957 1945 1989 521 548 1057 1063 1137 1823 1004 1017 229 459
output:
10
result:
ok single line: '10'
Test #21:
score: 0
Accepted
time: 8ms
memory: 37504kb
input:
10 10 324854 1281 1570 126 135 1900 1963 1578 1583 1593 1693 17 98 1079 1246 1832 1850 187 449 569 739 1960 1970 1262 1402 1704 1707 940 1104 1628 1676 1716 1727 1808 1869 1877 1892 1560 1565 145 337
output:
10
result:
ok single line: '10'
Test #22:
score: 0
Accepted
time: 8ms
memory: 37524kb
input:
10 10 73118142 223 258 514 576 1173 1204 712 1162 653 656 342 458 1633 1831 1891 1923 1288 1609 133 206 118 138 1440 1494 1332 1432 152 509 65 109 712 748 1532 1578 611 669 1946 1957 513 519
output:
10
result:
ok single line: '10'
Test #23:
score: 0
Accepted
time: 0ms
memory: 38452kb
input:
1 1 217 366 1554 481 937
output:
2
result:
ok single line: '2'
Test #24:
score: 0
Accepted
time: 7ms
memory: 37832kb
input:
1 1 223 1577 1888 243 879
output:
2
result:
ok single line: '2'
Test #25:
score: 0
Accepted
time: 2ms
memory: 36924kb
input:
1 1 95 1009 1709 1182 1759
output:
2
result:
ok single line: '2'
Test #26:
score: 0
Accepted
time: 4ms
memory: 37784kb
input:
1 1 39 1210 1758 864 1497
output:
2
result:
ok single line: '2'
Test #27:
score: 0
Accepted
time: 8ms
memory: 37852kb
input:
1 1 197 426 1381 926 1911
output:
2
result:
ok single line: '2'
Test #28:
score: 0
Accepted
time: 4ms
memory: 38280kb
input:
2 2 259 1047 1333 1560 1784 1587 1963 31 532
output:
4
result:
ok single line: '4'
Test #29:
score: 0
Accepted
time: 7ms
memory: 37604kb
input:
2 2 263 942 1287 1472 1620 610 783 1123 1183
output:
3
result:
ok single line: '3'
Test #30:
score: 0
Accepted
time: 4ms
memory: 37932kb
input:
2 2 12 709 1247 1344 1924 1973 1993 256 811
output:
4
result:
ok single line: '4'
Test #31:
score: 0
Accepted
time: 11ms
memory: 38652kb
input:
2 2 289 1936 1962 111 426 699 717 757 1534
output:
4
result:
ok single line: '4'
Test #32:
score: 0
Accepted
time: 9ms
memory: 38092kb
input:
10 2 13 728 734 1682 1716 1962 1964 917 918 1028 1220 455 459 1514 1537 505 588 1968 1986 1336 1441 1838 1842 904 1063
output:
12
result:
ok single line: '12'
Test #33:
score: 0
Accepted
time: 13ms
memory: 38580kb
input:
10 2 147 1684 1853 1562 1611 1217 1246 519 586 1104 1130 121 267 1461 1528 1555 1558 467 512 457 467 1764 1803 891 1103
output:
11
result:
ok single line: '11'
Test #34:
score: 0
Accepted
time: 5ms
memory: 37764kb
input:
2 10 105 1429 1992 1994 2000 312 356 1285 1307 247 283 822 827 1327 1908 205 214 456 697 784 803 975 1181 840 852
output:
12
result:
ok single line: '12'
Test #35:
score: 0
Accepted
time: 5ms
memory: 38120kb
input:
2 10 88 127 248 381 439 1812 1870 1900 1988 1332 1339 299 300 1512 1811 796 859 298 299 22 86 395 793 1041 1062
output:
11
result:
ok single line: '11'
Test #36:
score: 0
Accepted
time: 3ms
memory: 38336kb
input:
10 1 13 1186 1197 1551 1683 1725 1751 720 855 1027 1118 225 232 224 225 1849 1978 300 672 896 1017 1416 1650
output:
11
result:
ok single line: '11'
Test #37:
score: 0
Accepted
time: 11ms
memory: 38860kb
input:
10 1 147 1759 1772 973 978 1561 1632 458 773 1198 1266 139 153 987 1132 1820 1997 1157 1167 1536 1558 1875 1894
output:
10
result:
ok single line: '10'
Test #38:
score: 0
Accepted
time: 5ms
memory: 37244kb
input:
1 10 105 1601 1738 938 1059 70 108 152 194 1367 1389 1897 1912 1464 1668 1782 1847 243 338 785 845 197 209
output:
11
result:
ok single line: '11'
Test #39:
score: 0
Accepted
time: 5ms
memory: 37512kb
input:
1 10 88 1831 1885 225 342 208 210 1537 1790 1289 1290 160 197 652 661 689 776 1171 1252 1291 1459 813 870
output:
11
result:
ok single line: '11'
Test #40:
score: 0
Accepted
time: 2ms
memory: 38380kb
input:
10 10 43 1112 1136 1173 1242 196 313 1561 1603 1341 1448 428 756 1951 1989 1299 1310 1731 1919 1267 1279 1649 1682 1990 1992 295 380 883 898 15 46 1744 1784 1233 1426 1569 1603 150 173 560 723
output:
18
result:
ok single line: '18'
Test #41:
score: 0
Accepted
time: 7ms
memory: 37304kb
input:
10 10 131 1297 1299 791 825 882 968 972 1251 1293 1294 1497 1605 185 740 1460 1473 1329 1448 1861 1904 1422 1439 995 1088 1289 1321 1678 1915 372 585 760 761 1145 1170 1244 1281 16 277 765 979
output:
15
result:
ok single line: '15'
Test #42:
score: 0
Accepted
time: 3ms
memory: 38456kb
input:
10 10 286 1146 1277 224 231 302 921 1586 1708 193 201 1979 1989 999 1034 1086 1123 231 235 1058 1071 350 635 668 701 1589 1976 892 1282 1502 1568 9 22 221 295 788 867 29 89 1401 1446
output:
14
result:
ok single line: '14'
Test #43:
score: 0
Accepted
time: 13ms
memory: 37704kb
input:
10 10 99 71 108 448 470 1286 1348 1732 1966 1225 1233 1161 1174 1680 1725 480 937 109 152 223 335 1456 1465 1276 1299 1252 1254 1488 1879 101 118 159 203 1407 1437 1330 1353 898 1075 427 725
output:
15
result:
ok single line: '15'
Test #44:
score: 0
Accepted
time: 3ms
memory: 37896kb
input:
10 10 293 1260 1747 1170 1226 817 891 1763 1960 411 415 476 497 423 434 904 1096 551 716 156 323 615 630 1596 1764 133 185 384 603 1269 1371 976 1155 1156 1166 44 93 188 332 715 804
output:
11
result:
ok single line: '11'
Test #45:
score: 0
Accepted
time: 3ms
memory: 38852kb
input:
10 9 219 22 32 270 284 1291 1365 442 617 1198 1274 1624 1840 1172 1174 363 389 43 79 793 906 621 630 1788 1922 50 63 190 219 634 840 271 289 1784 1785 1111 1130 1351 1729
output:
13
result:
ok single line: '13'
Test #46:
score: 0
Accepted
time: 4ms
memory: 37156kb
input:
8 9 292 1623 1648 291 870 264 289 953 1208 1401 1587 1732 1903 1728 1732 924 938 361 475 624 825 1202 1219 1042 1119 960 1027 286 293 1252 1296 1305 1397 1769 1999
output:
11
result:
ok single line: '11'
Test #47:
score: 0
Accepted
time: 7ms
memory: 38956kb
input:
10 7 230 139 205 1593 1726 536 540 263 449 219 246 1754 1758 830 1046 1864 1873 1222 1225 1269 1421 570 649 806 818 1034 1512 443 562 820 972 1608 1901 741 775
output:
13
result:
ok single line: '13'
Test #48:
score: 0
Accepted
time: 11ms
memory: 37376kb
input:
3 5 150 501 541 1442 1596 762 992 1351 1491 1564 1635 316 361 648 1016 1180 1351
output:
7
result:
ok single line: '7'
Test #49:
score: 0
Accepted
time: 4ms
memory: 38884kb
input:
6 10 150 1710 1753 572 768 1630 1634 1638 1648 1480 1577 817 1271 7 46 687 793 87 161 1845 1973 1346 1395 1711 1810 884 1050 285 584 1458 1621 1056 1207
output:
13
result:
ok single line: '13'
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #50:
score: 10
Accepted
time: 3ms
memory: 37760kb
input:
196 2 2 903 907 1092 1095 1044 1045 1965 1973 475 483 1291 1292 1909 1913 1210 1241 195 203 1143 1144 17 25 1808 1811 1832 1834 96 104 1895 1899 1462 1473 1169 1171 280 281 860 863 174 182 756 757 1090 1092 747 752 298 299 1654 1659 850 857 59 66 320 342 909 910 130 131 1630 1632 489 490 1823 1826 1...
output:
198
result:
ok single line: '198'
Test #51:
score: 0
Accepted
time: 9ms
memory: 38220kb
input:
113 2 10 1225 1232 489 496 863 869 1316 1323 130 138 1723 1733 1792 1796 1603 1627 126 130 1601 1603 1856 1870 1561 1583 870 915 802 806 1667 1677 1167 1191 1778 1779 592 593 1840 1844 1513 1519 1542 1547 757 766 1839 1840 1677 1684 1927 1934 76 77 995 1026 1139 1140 1705 1716 635 675 1488 1493 1590...
output:
115
result:
ok single line: '115'
Test #52:
score: 0
Accepted
time: 11ms
memory: 36988kb
input:
2 180 8 1138 1978 747 987 1731 1732 1009 1010 790 809 827 828 1714 1715 375 377 166 167 57 61 700 707 634 641 1410 1415 1103 1108 963 965 395 408 594 600 64 78 1496 1505 1205 1232 1822 1828 1510 1512 53 57 996 997 1710 1714 698 699 784 786 559 560 366 375 1645 1655 517 550 113 118 1771 1778 988 991 ...
output:
180
result:
ok single line: '180'
Test #53:
score: 0
Accepted
time: 4ms
memory: 37076kb
input:
2 165 7 424 885 1285 1699 1124 1125 496 497 663 671 752 756 1282 1295 569 570 732 737 346 352 1809 1810 965 975 1719 1721 407 409 912 916 100 104 333 334 357 358 1515 1530 1017 1031 1844 1849 1371 1376 413 420 1309 1321 1162 1167 1580 1583 1726 1735 1799 1803 1742 1745 317 322 309 311 253 257 157 15...
output:
167
result:
ok single line: '167'
Test #54:
score: 0
Accepted
time: 4ms
memory: 37268kb
input:
1 1 1 0 1 0 1
output:
1
result:
ok single line: '1'
Test #55:
score: 0
Accepted
time: 7ms
memory: 37944kb
input:
1 1997 2 1 2000 146 147 1863 1864 157 158 1465 1466 677 678 980 981 1692 1693 1480 1481 1270 1271 406 407 1771 1772 1686 1687 1540 1541 1879 1880 217 218 1211 1212 1002 1003 1025 1026 779 780 1963 1964 1175 1176 876 877 519 520 1791 1792 569 570 1835 1836 50 51 1393 1394 1671 1672 656 657 929 930 10...
output:
1997
result:
ok single line: '1997'
Test #56:
score: 0
Accepted
time: 10ms
memory: 39952kb
input:
999 999 1 1120 1122 988 990 1612 1614 1650 1652 1954 1956 698 700 1794 1796 420 422 406 408 1314 1316 246 248 1202 1204 22 24 766 768 1036 1038 1258 1260 1684 1686 6 8 1118 1120 1520 1522 286 288 224 226 1644 1646 144 146 594 596 1914 1916 318 320 888 890 444 446 1344 1346 1368 1370 1740 1742 708 71...
output:
1998
result:
ok single line: '1998'
Test #57:
score: 0
Accepted
time: 10ms
memory: 38240kb
input:
999 999 1 1504 1506 1374 1376 1164 1166 1306 1308 1012 1014 92 94 378 380 1240 1242 1126 1128 210 212 758 760 1626 1628 800 802 1734 1736 478 480 198 200 1256 1258 1756 1758 1678 1680 390 392 838 840 1316 1318 1100 1102 392 394 1850 1852 278 280 1296 1298 618 620 176 178 914 916 1856 1858 1450 1452 ...
output:
1998
result:
ok single line: '1998'
Test #58:
score: 0
Accepted
time: 3ms
memory: 37080kb
input:
10 10 166 1660 1992 4 5 996 1328 1 2 332 664 1328 1660 2 3 0 1 664 996 3 4 334 335 1494 1826 498 830 0 332 335 336 336 337 830 1162 332 333 333 334 1162 1494
output:
20
result:
ok single line: '20'
Test #59:
score: 0
Accepted
time: 14ms
memory: 38148kb
input:
10 10 166 0 1 4 5 1328 1660 3 4 664 996 332 664 996 1328 2 3 1 2 1999 2000 830 1162 1999 2000 332 333 498 830 334 335 0 332 335 336 336 337 333 334 1162 1494
output:
19
result:
ok single line: '19'
Test #60:
score: 0
Accepted
time: 5ms
memory: 38668kb
input:
100 100 10 4 5 320 340 780 800 1340 1360 40 60 200 220 920 940 0 1 680 700 2 3 1500 1520 1040 1060 500 520 620 640 1300 1320 980 1000 140 160 1240 1260 580 600 1440 1460 60 80 180 200 520 540 7 8 1780 1800 460 480 8 9 760 780 1820 1840 1260 1280 1460 1480 1060 1080 1100 1120 1080 1100 1380 1400 3 4 ...
output:
200
result:
ok single line: '200'
Test #61:
score: 0
Accepted
time: 9ms
memory: 38916kb
input:
100 100 10 840 860 20 40 320 340 1800 1820 1340 1360 240 260 300 320 7 8 220 240 140 160 400 420 1560 1580 1580 1600 200 220 1020 1040 720 740 1300 1320 260 280 340 360 1680 1700 1200 1220 120 140 1520 1540 980 1000 660 680 1140 1160 440 460 100 120 500 520 1280 1300 600 620 180 200 760 780 2 3 280 ...
output:
199
result:
ok single line: '199'
Test #62:
score: 0
Accepted
time: 4ms
memory: 39104kb
input:
1500 1500 1 1412 1413 767 768 1122 1123 1487 1488 988 989 782 783 1147 1148 298 299 343 344 433 434 1246 1247 1968 1969 1439 1441 1642 1644 799 800 1826 1827 1422 1423 873 875 903 904 1615 1616 744 745 70 71 1537 1539 1211 1212 538 539 983 984 1252 1253 865 866 1977 1978 1753 1754 803 804 998 999 55...
output:
1947
result:
ok single line: '1947'
Test #63:
score: 0
Accepted
time: 4ms
memory: 38680kb
input:
2000 2000 1000000000 212 213 428 429 1960 1961 1506 1507 1291 1292 996 997 1327 1328 168 169 1631 1632 574 575 92 93 176 177 446 447 1350 1351 506 507 1331 1332 1872 1873 198 199 1466 1467 1282 1283 1039 1040 1972 1973 1405 1406 80 81 1309 1310 389 390 224 225 1053 1054 1083 1084 814 815 258 259 13 ...
output:
2000
result:
ok single line: '2000'
Test #64:
score: 0
Accepted
time: 4ms
memory: 38840kb
input:
2000 2000 2000 1454 1455 495 496 963 964 1519 1520 1078 1079 731 732 638 639 1522 1523 1864 1865 675 676 491 492 1954 1955 1815 1816 900 901 737 738 1165 1166 1854 1855 781 782 271 272 1698 1699 637 638 623 624 1026 1027 1367 1368 714 715 9 10 291 292 397 398 214 215 318 319 1743 1744 1130 1131 1612...
output:
2000
result:
ok single line: '2000'
Test #65:
score: 0
Accepted
time: 8ms
memory: 39120kb
input:
1892 394 5 569 570 394 395 409 410 251 252 758 759 102 103 37 38 110 111 90 92 1584 1585 984 985 1110 1111 866 867 1344 1345 1362 1363 995 996 1940 1941 1504 1505 269 270 1742 1743 1891 1892 1089 1090 1692 1693 1915 1916 1626 1627 1136 1137 516 518 796 797 1139 1140 717 718 1594 1595 2 3 1085 1086 9...
output:
1892
result:
ok single line: '1892'
Test #66:
score: 0
Accepted
time: 4ms
memory: 38492kb
input:
831 1432 2 1260 1262 1030 1031 411 413 407 410 48 51 1087 1090 730 733 1268 1270 976 977 116 117 550 552 512 514 1172 1174 479 480 505 506 1117 1118 1388 1389 1699 1700 746 752 691 694 846 847 562 565 86 87 1529 1530 270 271 486 487 1443 1444 995 996 1700 1701 1943 1946 1200 1202 415 416 100 101 908...
output:
1505
result:
ok single line: '1505'
Test #67:
score: -10
Wrong Answer
time: 3ms
memory: 38020kb
input:
1452 1660 6 843 844 1348 1349 1765 1766 1400 1401 1459 1463 1589 1590 649 650 1650 1651 655 656 50 51 1550 1551 605 606 1207 1208 1043 1044 568 569 573 574 1570 1572 1778 1779 89 90 844 845 1771 1772 899 900 1975 1976 1723 1724 1188 1189 1649 1650 1517 1518 1394 1395 330 332 1531 1532 657 658 1746 1...
output:
1659
result:
wrong answer 1st lines differ - expected: '1658', found: '1659'
Subtask #3:
score: 0
Wrong Answer
Test #104:
score: 6
Accepted
time: 3ms
memory: 37768kb
input:
1 1 1 0 1 0 1
output:
1
result:
ok single line: '1'
Test #105:
score: 0
Accepted
time: 9ms
memory: 37452kb
input:
1 2000 2 999999996 1000000000 336 337 502 503 1906 1907 963 964 1351 1352 1795 1796 1510 1511 304 305 1930 1931 1735 1736 1469 1470 338 339 813 814 182 183 209 210 321 322 849 850 721 722 394 395 889 890 1758 1759 1440 1441 560 561 1470 1471 1916 1917 793 794 1366 1367 158 159 1602 1603 214 215 1119...
output:
2000
result:
ok single line: '2000'
Test #106:
score: 0
Accepted
time: 26ms
memory: 41080kb
input:
2000 2000 249875 608195750 608695500 88455750 88955500 579210250 579710000 817091250 817591000 527736000 528235750 52473750 52973500 89955000 90454750 184407750 184907500 668165750 668665500 24487750 24987500 466266750 466766500 471764000 472263750 212393750 212893500 250874500 251374250 939530000 9...
output:
4000
result:
ok single line: '4000'
Test #107:
score: 0
Accepted
time: 29ms
memory: 39856kb
input:
2000 2000 249875 965017250 965517000 73963000 74462750 242878500 243378250 148925500 149425250 747126250 747626000 384307750 384807500 655172250 655672000 278360750 278860500 899050250 899550000 496251750 496751500 92953500 93453250 677661000 678160750 828085750 828585500 297351250 297851000 5887055...
output:
4000
result:
ok single line: '4000'
Test #108:
score: 0
Accepted
time: 18ms
memory: 40012kb
input:
2000 2000 499500 428 429 764235000 765234000 511488000 512487000 291 292 585414000 586413000 127 128 819 820 727 728 233766000 234765000 643 644 234 235 326 327 432 433 218781000 219780000 10989000 11988000 805194000 806193000 283716000 284715000 965034000 966033000 632367000 633366000 824 825 454 4...
output:
4000
result:
ok single line: '4000'
Test #109:
score: 0
Accepted
time: 16ms
memory: 39004kb
input:
2000 2000 499500 175 176 766233000 767232000 230 231 925 926 844 845 681318000 682317000 48951000 49950000 757 758 266 267 438561000 439560000 262737000 263736000 813 814 915084000 916083000 485514000 486513000 214785000 215784000 532467000 533466000 25 26 41958000 42957000 534 535 331 332 53 54 732...
output:
3999
result:
ok single line: '3999'
Test #110:
score: 0
Accepted
time: 15ms
memory: 39376kb
input:
2000 2000 1 97918740 97918742 612788646 612788648 709014683 709014684 550596486 550596488 611820813 611820815 742133170 742133172 999593290 999593292 65695562 65695563 984598976 984598977 285428771 285428773 334881813 334881814 751309389 751309390 635034524 635034526 202056719 202056720 472216430 47...
output:
4000
result:
ok single line: '4000'
Test #111:
score: 0
Accepted
time: 8ms
memory: 38352kb
input:
2000 2000 1000000000 762582513 763402869 685982674 685994777 607586653 607621748 725505868 725606928 287661547 287711487 961278566 961422544 282891861 282922769 388240582 388471546 305173664 305545845 17696180 17939334 267223086 267237726 251362344 251735629 957622587 957813570 321979347 321992100 7...
output:
2000
result:
ok single line: '2000'
Test #112:
score: 0
Accepted
time: 8ms
memory: 39168kb
input:
2000 2000 1000000000 675 676 1250 1251 1565 1566 211 212 951 952 250 251 1975 1976 775 776 795 796 85 86 212 213 293 294 1970 1971 627 628 1945 1946 688 689 1050 1051 223 224 288 289 476 477 137 138 613 614 1400 1401 1087 1088 801 802 734 735 1112 1113 51 52 1127 1128 546 547 881 882 276 277 680 681...
output:
2000
result:
ok single line: '2000'
Test #113:
score: 0
Accepted
time: 9ms
memory: 37404kb
input:
2000 2000 2000 683 684 170 171 1005 1006 1612 1613 330 331 280 281 1340 1341 1083 1084 355 356 1603 1604 1001 1002 873 874 1520 1521 1657 1658 1827 1828 1868 1869 655 656 1981 1982 184 185 900 901 1917 1918 1096 1097 956 957 987 988 536 537 921 922 317 318 869 870 1095 1096 1684 1685 762 763 1896 18...
output:
2000
result:
ok single line: '2000'
Test #114:
score: 0
Accepted
time: 8ms
memory: 39276kb
input:
89 1537 3 1761 1764 1885 1887 1489 1490 1523 1528 1491 1494 1204 1206 288 293 1433 1439 233 235 1007 1009 1630 1635 1297 1301 359 363 1559 1561 1918 1922 1160 1161 1374 1377 418 420 248 252 1826 1831 1051 1053 720 722 276 279 1516 1522 1638 1639 28 34 1392 1394 1867 1869 1030 1035 961 964 951 954 56...
output:
1538
result:
ok single line: '1538'
Test #115:
score: 0
Accepted
time: 10ms
memory: 39428kb
input:
1530 1057 6 333 334 1671 1672 855 856 237 238 429 430 172 173 1721 1722 784 785 485 486 771 772 1563 1564 781 784 852 854 510 511 754 755 1640 1641 1748 1749 152 153 1286 1287 1765 1766 483 484 1374 1375 1435 1436 1081 1082 1960 1961 1512 1513 1001 1002 1287 1288 1737 1738 1213 1214 901 902 271 272 ...
output:
1530
result:
ok single line: '1530'
Test #116:
score: 0
Accepted
time: 5ms
memory: 37664kb
input:
1852 95 2 1686 1687 1089 1090 1406 1407 1703 1704 270 271 124 125 1656 1657 1467 1468 1244 1245 198 199 720 721 240 241 954 955 1617 1618 1576 1577 693 694 887 888 1875 1876 65 66 210 211 972 973 60 61 1977 1978 1747 1748 88 89 1571 1572 1913 1914 959 960 978 979 1592 1593 160 161 911 912 1923 1924 ...
output:
1852
result:
ok single line: '1852'
Test #117:
score: 0
Accepted
time: 7ms
memory: 39404kb
input:
2000 2000 8 113542287 113542302 390186210 390186213 767610940 767610945 166969613 166969625 576186044 576186049 900919537 900919544 65847079 65847093 914274569 914274570 717871869 717871873 446375619 446375623 411070467 411070470 118697002 118697012 686550784 686550796 825791725 825791731 986657892 ...
output:
4000
result:
ok single line: '4000'
Test #118:
score: 0
Accepted
time: 10ms
memory: 39228kb
input:
2000 2000 5 323112971 323112977 625095129 625095132 724765420 724765421 63941016 63941019 914151487 914151492 984437587 984437595 208379851 208379858 839949614 839949623 928366669 928366671 561458859 561458867 972589960 972589964 576223356 576223364 739171385 739171390 663662925 663662932 525889027 ...
output:
4000
result:
ok single line: '4000'
Test #119:
score: 0
Accepted
time: 7ms
memory: 37524kb
input:
2000 2000 6 298171660 298171662 490725349 490725356 36304805 36304811 207802050 207802060 837587473 837587479 987183666 987183676 560955022 560955034 287590452 287590463 694565254 694565264 859529266 859529272 541494910 541494922 771349806 771349812 225787473 225787476 648584932 648584944 905255077 ...
output:
4000
result:
ok single line: '4000'
Test #120:
score: 0
Accepted
time: 5ms
memory: 39224kb
input:
1641 1376 22 377 378 697 698 693 694 210 211 1214 1216 1345 1346 846 847 1532 1533 1935 1937 1069 1070 1597 1598 318 319 1066 1067 886 887 1302 1303 1103 1105 631 632 1787 1788 1063 1064 1152 1154 227 228 351 352 1718 1719 754 755 238 239 651 652 704 705 601 602 1332 1333 1945 1946 421 422 1392 1393...
output:
1641
result:
ok single line: '1641'
Test #121:
score: -6
Wrong Answer
time: 7ms
memory: 38836kb
input:
718 741 39 1263 1273 1019 1020 1202 1205 1105 1106 1194 1195 459 463 548 550 1821 1825 1853 1854 1664 1665 831 832 26 27 705 706 1832 1833 1466 1467 1438 1439 1841 1842 590 591 1981 1983 1310 1314 1850 1853 1978 1980 1948 1949 993 994 743 746 702 704 1748 1751 956 957 536 539 1694 1696 653 654 54 55...
output:
739
result:
wrong answer 1st lines differ - expected: '735', found: '739'
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%