QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#793037 | #8952. 解谜游戏 | misfits# | 40 | 289ms | 4104kb | C++14 | 1.8kb | 2024-11-29 16:06:37 | 2024-11-29 16:06:38 |
Judging History
answer
#include<bits/stdc++.h>
#include "puzzle.h"
#define LL int
#define SZ(x) ((LL)(x.size()))
#define all(x) (x).begin(),(x).end()
using namespace std;
/*inline LL read(){
LL q=0,w=1;char ch=getchar();
while(ch>'9' || ch<'0'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){q=q*10+(ch-'0');ch=getchar();}
return q*w;
}
void write(LL x){
if(x<0){putchar('-');x=(-x);}
if(x>9)write(x/10);
putchar('0'+x%10);
}
inline void writeln(LL x){write(x);puts("");}
inline void writecs(LL x){write(x);putchar(' ');}*/
inline void dmin(LL &x,LL y){if(x>y)x=y;return ;}
inline void dmax(LL &x,LL y){if(x<y)x=y;return ;}
#define cout cerr
#define pb push_back
namespace GenHelper{
#define ull unsigned long long
ull seed=19260817ull;
inline void Get(){seed^=(seed<<7);seed^=(seed>>11);seed^=(seed<<13);}
inline ull Rand(){Get();return (seed^(seed<<32ull));}
}using GenHelper::Rand;
inline LL random(LL l,LL r){return (Rand()%(r-l+1)+l);}
const LL N = 1000+95 ;
bitset<N>ok[N];LL a[N];
void play(LL n){
LL SUM=n*(n-1);
for(LL x=0;x<n;x++){a[x]=n;for(LL i=0;i<n;i++)ok[x][i]=1;}
LL _TC_=0;
while(true){
_TC_++;
vector<LL>p(n);
for(LL i=0;i<n;i++)p[i]=i;
for(LL i=0;i<n;i++)swap(p[i],p[random(0,(n-1))]);
LL fl=0;
for(LL i=0;i<n;i++)if(ok[i][p[i]]){fl++;}
if(!fl)continue;
// cerr<<" fl = "<<fl<<" SUM = "<<SUM<<" n = "<<n<<endl;
if(fl<=(LL)(1.0*min(SUM,n)/sqrt(_TC_)))continue;
LL cnt=query(p);
if(!cnt){for(LL i=0;i<n;i++){a[i]-=ok[i][p[i]];SUM-=ok[i][p[i]];ok[i][p[i]]=0;}}
LL TC=0;
for(LL i=0;i<n;i++)TC+=((a[i]==1)?(1):(0));
if(TC==n)break;
}
vector<LL>p;
for(LL i=0;i<n;i++)
for(LL j=0;j<n;j++)if(ok[i][j])p.pb(j);
check(p);return ;
}
详细
Subtask #1:
score: 2
Accepted
Test #1:
score: 2
Accepted
time: 0ms
memory: 3868kb
input:
1 2 816815200
result:
ok accepted: cnt = 1
Test #2:
score: 2
Accepted
time: 0ms
memory: 3772kb
input:
1 3 723182155
result:
ok accepted: cnt = 11
Test #3:
score: 2
Accepted
time: 0ms
memory: 3868kb
input:
1 5 971867682
result:
ok accepted: cnt = 30
Test #4:
score: 2
Accepted
time: 0ms
memory: 3888kb
input:
1 3 887042235
result:
ok accepted: cnt = 3
Test #5:
score: 2
Accepted
time: 0ms
memory: 3716kb
input:
1 3 568659743
result:
ok accepted: cnt = 11
Test #6:
score: 2
Accepted
time: 0ms
memory: 4028kb
input:
1 5 930991667
result:
ok accepted: cnt = 44
Test #7:
score: 2
Accepted
time: 0ms
memory: 4024kb
input:
1 5 185481439
result:
ok accepted: cnt = 21
Test #8:
score: 2
Accepted
time: 0ms
memory: 3880kb
input:
1 5 405685705
result:
ok accepted: cnt = 30
Test #9:
score: 2
Accepted
time: 0ms
memory: 3884kb
input:
1 5 693401039
result:
ok accepted: cnt = 25
Test #10:
score: 2
Accepted
time: 0ms
memory: 3768kb
input:
1 5 570594473
result:
ok accepted: cnt = 40
Subtask #2:
score: 4
Accepted
Test #11:
score: 4
Accepted
time: 0ms
memory: 4024kb
input:
2 2 931107645
result:
ok accepted: cnt = 1
Test #12:
score: 4
Accepted
time: 0ms
memory: 3716kb
input:
2 4 512124670
result:
ok accepted: cnt = 13
Test #13:
score: 4
Accepted
time: 0ms
memory: 3880kb
input:
2 4 793864173
result:
ok accepted: cnt = 17
Test #14:
score: 4
Accepted
time: 0ms
memory: 3820kb
input:
2 7 322910591
result:
ok accepted: cnt = 69
Test #15:
score: 4
Accepted
time: 0ms
memory: 3800kb
input:
2 9 316192686
result:
ok accepted: cnt = 95
Test #16:
score: 4
Accepted
time: 0ms
memory: 3808kb
input:
2 10 350886420
result:
ok accepted: cnt = 74
Test #17:
score: 4
Accepted
time: 0ms
memory: 3892kb
input:
2 10 914937911
result:
ok accepted: cnt = 73
Test #18:
score: 4
Accepted
time: 0ms
memory: 4016kb
input:
2 10 68729974
result:
ok accepted: cnt = 86
Test #19:
score: 4
Accepted
time: 0ms
memory: 3816kb
input:
2 10 15788440
result:
ok accepted: cnt = 60
Test #20:
score: 4
Accepted
time: 0ms
memory: 3880kb
input:
2 10 950846282
result:
ok accepted: cnt = 98
Subtask #3:
score: 6
Accepted
Test #21:
score: 6
Accepted
time: 0ms
memory: 4036kb
input:
3 2 667362636
result:
ok accepted: cnt = 3
Test #22:
score: 6
Accepted
time: 0ms
memory: 3876kb
input:
3 4 890842001
result:
ok accepted: cnt = 13
Test #23:
score: 6
Accepted
time: 0ms
memory: 3876kb
input:
3 3 225277415
result:
ok accepted: cnt = 3
Test #24:
score: 6
Accepted
time: 0ms
memory: 3872kb
input:
3 26 235413642
result:
ok accepted: cnt = 446
Test #25:
score: 6
Accepted
time: 0ms
memory: 3816kb
input:
3 25 139642984
result:
ok accepted: cnt = 320
Test #26:
score: 6
Accepted
time: 1ms
memory: 3808kb
input:
3 30 991911708
result:
ok accepted: cnt = 750
Test #27:
score: 6
Accepted
time: 0ms
memory: 3952kb
input:
3 30 4514256
result:
ok accepted: cnt = 479
Test #28:
score: 6
Accepted
time: 0ms
memory: 4024kb
input:
3 30 157113423
result:
ok accepted: cnt = 394
Test #29:
score: 6
Accepted
time: 0ms
memory: 4032kb
input:
3 30 557648974
result:
ok accepted: cnt = 364
Test #30:
score: 6
Accepted
time: 1ms
memory: 4020kb
input:
3 30 645022468
result:
ok accepted: cnt = 598
Test #31:
score: 6
Accepted
time: 0ms
memory: 3808kb
input:
4 2 427653480
result:
ok accepted: cnt = 3
Test #32:
score: 6
Accepted
time: 0ms
memory: 4020kb
input:
4 3 219860551
result:
ok accepted: cnt = 11
Test #33:
score: 6
Accepted
time: 0ms
memory: 3868kb
input:
4 4 165138325
result:
ok accepted: cnt = 12
Test #34:
score: 6
Accepted
time: 3ms
memory: 3728kb
input:
4 93 525060479
result:
ok accepted: cnt = 2565
Test #35:
score: 6
Accepted
time: 2ms
memory: 3784kb
input:
4 99 829735778
result:
ok accepted: cnt = 2007
Subtask #4:
score: 8
Accepted
Test #36:
score: 8
Accepted
time: 2ms
memory: 3820kb
input:
4 100 6610818
result:
ok accepted: cnt = 2325
Test #37:
score: 8
Accepted
time: 3ms
memory: 4040kb
input:
4 100 653323659
result:
ok accepted: cnt = 3249
Test #38:
score: 8
Accepted
time: 3ms
memory: 3896kb
input:
4 100 268513130
result:
ok accepted: cnt = 2855
Test #39:
score: 8
Accepted
time: 3ms
memory: 3884kb
input:
4 100 479581529
result:
ok accepted: cnt = 2526
Test #40:
score: 8
Accepted
time: 3ms
memory: 4028kb
input:
4 100 119844914
result:
ok accepted: cnt = 2549
Subtask #5:
score: 10
Accepted
Test #41:
score: 10
Accepted
time: 0ms
memory: 4020kb
input:
5 2 527801655
result:
ok accepted: cnt = 1
Test #42:
score: 10
Accepted
time: 0ms
memory: 3808kb
input:
5 5 235665947
result:
ok accepted: cnt = 37
Test #43:
score: 10
Accepted
time: 0ms
memory: 3892kb
input:
5 3 648413779
result:
ok accepted: cnt = 3
Test #44:
score: 10
Accepted
time: 17ms
memory: 3912kb
input:
5 272 737778828
result:
ok accepted: cnt = 7526
Test #45:
score: 10
Accepted
time: 22ms
memory: 3924kb
input:
5 278 173436130
result:
ok accepted: cnt = 7805
Test #46:
score: 10
Accepted
time: 29ms
memory: 3852kb
input:
5 300 997862299
result:
ok accepted: cnt = 9281
Test #47:
score: 10
Accepted
time: 30ms
memory: 4068kb
input:
5 300 764271855
result:
ok accepted: cnt = 9917
Test #48:
score: 10
Accepted
time: 28ms
memory: 3736kb
input:
5 300 428892383
result:
ok accepted: cnt = 8959
Test #49:
score: 10
Accepted
time: 28ms
memory: 3872kb
input:
5 300 166706392
result:
ok accepted: cnt = 9096
Test #50:
score: 10
Accepted
time: 29ms
memory: 4076kb
input:
5 300 843444435
result:
ok accepted: cnt = 9556
Subtask #6:
score: 10
Accepted
Test #51:
score: 10
Accepted
time: 0ms
memory: 3812kb
input:
6 2 183795068
result:
ok accepted: cnt = 1
Test #52:
score: 10
Accepted
time: 0ms
memory: 3812kb
input:
6 5 63668012
result:
ok accepted: cnt = 24
Test #53:
score: 10
Accepted
time: 0ms
memory: 3716kb
input:
6 5 990398365
result:
ok accepted: cnt = 32
Test #54:
score: 10
Accepted
time: 89ms
memory: 3852kb
input:
6 488 942578687
result:
ok accepted: cnt = 16090
Test #55:
score: 10
Accepted
time: 93ms
memory: 4104kb
input:
6 475 915148470
result:
ok accepted: cnt = 18553
Test #56:
score: 10
Accepted
time: 106ms
memory: 3940kb
input:
6 500 736505651
result:
ok accepted: cnt = 19698
Test #57:
score: 10
Accepted
time: 94ms
memory: 3900kb
input:
6 500 352417213
result:
ok accepted: cnt = 16584
Test #58:
score: 10
Accepted
time: 90ms
memory: 4100kb
input:
6 500 80534667
result:
ok accepted: cnt = 15846
Test #59:
score: 10
Accepted
time: 92ms
memory: 3784kb
input:
6 500 811975157
result:
ok accepted: cnt = 16053
Test #60:
score: 10
Accepted
time: 95ms
memory: 3960kb
input:
6 500 471392863
result:
ok accepted: cnt = 16494
Subtask #7:
score: 0
Wrong Answer
Test #61:
score: 60
Accepted
time: 0ms
memory: 3672kb
input:
7 2 412859550
result:
ok accepted: cnt = 1
Test #62:
score: 60
Accepted
time: 0ms
memory: 3768kb
input:
7 4 892225546
result:
ok accepted: cnt = 33
Test #63:
score: 60
Accepted
time: 0ms
memory: 4028kb
input:
7 4 577686541
result:
ok accepted: cnt = 28
Test #64:
score: 0
Wrong Answer
time: 289ms
memory: 3696kb
input:
7 902 974849567
result:
wrong answer too_many_queries