QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#420747 | #8646. Card Collection | Kevin5307 | 0 | 21ms | 42956kb | C++23 | 2.3kb | 2024-05-24 21:40:07 | 2024-05-24 21:40:09 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int n,m;
int table1[9][9],table2[9][9];
bool dp[2020][2020][9];
int a[200200],b[200200],c[200200],d[200200];
int val[200200];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
for(int p=0;p<3;p++)
for(int q=0;q<3;q++)
for(int r=0;r<3;r++)
for(int s=0;s<3;s++)
{
table1[p*3+q][r*3+s]=min(p,r)*3+min(q,s);
table2[p*3+q][r*3+s]=max(p,r)*3+max(q,s);
}
cin>>n>>m;
for(int i=1;i<=n;i++)
cin>>a[i]>>b[i];
for(int i=1;i<=m;i++)
cin>>c[i]>>d[i];
for(int i=1;i<=m;i++)
{
memset(dp,0,sizeof(dp));
for(int j=1;j<=n;j++)
{
int val=((a[j]==c[i])?1:(a[j]<c[i]?0:2))*3+((b[j]==d[i])?1:(b[j]<d[i]?0:2));
dp[j][j][val]=1;
::val[j]=val;
}
int cnt1=0,cnt2=0;
for(int j=1;j<=n;j++)
if(val[j]/3==1)
cnt1++;
for(int j=1;j<=n;j++)
if(val[j]%3==1)
cnt2++;
if(cnt1>=2&&cnt2>=2)
{
cout<<i<<" ";
continue;
}
if(!cnt1||!cnt2)
continue;
int pos=-1;
for(int j=1;j<=n;j++)
if(val[j]==4)
pos=j;
set<int> st1,st2;
for(int j=1;j<pos;j++)
st1.insert(val[j]);
for(int j=pos+1;j<=n;j++)
st2.insert(val[j]);
if(sz(st1)==1&&*st1.begin()==6)
continue;
if(sz(st1)==1&&*st1.begin()==2)
continue;
if(sz(st2)==1&&*st1.begin()==6)
continue;
if(sz(st2)==1&&*st1.begin()==2)
continue;
for(int len=2;len<=n;len++)
for(int l=1,r=len;r<=n;l++,r++)
for(int k=l;k<r;k++)
for(int a=0;a<9;a++) if(dp[l][k][a])
for(int b=0;b<9;b++) if(dp[k+1][r][b])
{
dp[l][r][table1[a][b]]=1;
dp[l][r][table2[a][b]]=1;
}
if(dp[1][n][4])
cout<<i<<' ';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 11
Accepted
time: 20ms
memory: 42316kb
input:
2 10 171631799 561094698 171631799 867698918 126573648 561094698 171631799 867698918 171631799 561094698 126573648 561094698 126573648 561094698 171631799 561094698 126573648 561094698 126573648 561094698 126573648 561094698 171631799 561094698
output:
2 3 6 10
result:
ok 4 number(s): "2 3 6 10"
Test #2:
score: 0
Accepted
time: 15ms
memory: 42272kb
input:
3 10 713180371 43103927 713180371 136832929 853543805 251852293 892623928 251852293 713180371 136832929 713180371 43103927 853543805 43103927 892623928 136832929 713180371 43103927 853543805 43103927 892623928 136832929 713180371 43103927 892623928 251852293
output:
2 3 6 9
result:
ok 4 number(s): "2 3 6 9"
Test #3:
score: 0
Accepted
time: 13ms
memory: 41700kb
input:
4 10 254412080 855555783 254412080 534954259 610506813 184822793 804271098 233942602 804271098 233942602 536633825 184822793 254412080 855555783 804271098 233942602 536633825 233942602 254412080 855555783 804271098 534954259 610506813 534954259 536633825 184822793 536633825 855555783
output:
1 3 4 6 7 8
result:
ok 6 numbers
Test #4:
score: 0
Accepted
time: 12ms
memory: 42956kb
input:
5 10 148547041 170447714 617759855 170447714 617759855 963162312 148547041 948767426 423489361 460053818 423489361 460053818 817714720 948767426 617759855 673099807 617759855 963162312 617759855 673099807 423489361 460053818 423489361 460053818 817714720 948767426 817714720 170447714 148547041 67309...
output:
1 4 6 7
result:
ok 4 number(s): "1 4 6 7"
Test #5:
score: 0
Accepted
time: 20ms
memory: 42692kb
input:
6 10 452189481 369706489 974106249 369706489 152471743 55874110 152471743 7767562 623180600 783682263 116778263 783682263 974106249 369706489 452189481 7767562 623180600 7767562 116778263 783682263 330861484 7767562 452189481 640079581 974106249 640079581 623180600 783682263 974106249 7767562 116778...
output:
1 4 8
result:
ok 3 number(s): "1 4 8"
Test #6:
score: 0
Accepted
time: 15ms
memory: 41808kb
input:
7 10 546365360 29458595 459505526 682968936 892069847 113227141 892069847 682968936 459505526 895773339 436538726 29458595 892069847 29458595 892069847 21442381 200908509 682968936 84249914 782064261 691849455 682968936 691849455 682968936 691849455 21442381 691849455 682968936 691849455 21442381 84...
output:
result:
ok 0 number(s): ""
Test #7:
score: 0
Accepted
time: 18ms
memory: 42940kb
input:
8 10 53884460 816621582 931458006 534340303 53884460 621933704 317941616 487589985 53884460 793793344 831491668 487589985 53884460 816621582 53884460 417129074 831491668 417129074 317941616 534340303 395845824 793793344 395845824 417129074 317941616 166559933 100528187 487589985 83144683 816621582 8...
output:
2 10
result:
ok 2 number(s): "2 10"
Test #8:
score: 0
Accepted
time: 10ms
memory: 42948kb
input:
9 10 703128946 628411749 703128946 876135124 678057110 783023566 563107567 908344997 255577987 177945114 703128946 177945114 519769912 951772210 678057110 470396423 703128946 470396423 563107567 783023566 813952930 470396423 230207898 177945114 230207898 628411749 519769912 555485281 703128946 78302...
output:
1 6
result:
ok 2 number(s): "1 6"
Test #9:
score: 0
Accepted
time: 21ms
memory: 42620kb
input:
10 10 411828800 587312736 368564282 297078085 368564282 265187364 287645241 405039514 368564282 535066135 368564282 265187364 701629305 581674146 894581821 581674146 600278299 347261251 368564282 390901645 633230417 151902557 287645241 297078085 1782717 405039514 287645241 587312736 894581821 587312...
output:
2 5 7
result:
ok 3 number(s): "2 5 7"
Test #10:
score: 0
Accepted
time: 11ms
memory: 42376kb
input:
11 10 594865443 637250974 223004376 637250974 785025296 887146590 120666718 887146590 31665956 652873089 594865443 887146590 1682073 112213166 31665956 121276446 785025296 121276446 28305142 652873089 28305142 661968377 1682073 120498688 938018458 887146590 120666718 112213166 28305142 112213166 223...
output:
10
result:
ok 1 number(s): "10"
Test #11:
score: -11
Wrong Answer
time: 16ms
memory: 41448kb
input:
12 10 39186066 168002748 671722214 32295292 39186066 469855569 442075770 469855569 689698028 968471023 3489285 168002748 671722214 968471023 182809077 689539890 481317320 742954502 265274602 32295292 265274602 26013512 481317320 742954502 976556207 168425358 689698028 32295292 749415058 545907259 24...
output:
7 8 10
result:
wrong answer 1st numbers differ - expected: '10', found: '7'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%