QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#324726 | #5533. Trick | hotboy2703 | 0 | 0ms | 0kb | C++14 | 1.6kb | 2024-02-10 23:26:21 | 2024-02-10 23:26:21 |
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define pll pair <ll,ll>
#define fi first
#define se second
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1LL)
#define MASK(i) (1LL << (i))
mt19937_64 rng(1);
mt19937_64 rng2(chrono::steady_clock::now().time_since_epoch().count());
ll random2(ll l,ll r){
return rng2()%(r-l+1)+l;
}
ll random(ll l,ll r){
return rng()%(r-l+1)+l;
}
ll myrandom(ll i){
return rng()%i;
}
ll f(ll x,ll y,ll n){
rng.seed(((x+1)*(2*n+5)+y+1+69420)*45);
return random(0,2*n);
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
// freopen("trick.in","r",stdin);
// freopen("trick.out","w",stdout);
ll t;
cin>>t;
ll task;
cin>>task;
while(t--){
ll n;
cin>>n;
if (task==3){
ll a,b,c,d;
cin>>a>>b>>c>>d;
ll res = -(f(a,b,n)+f(c,d,n));
res = (res%(2*n+1)+2*n+1)%(2*n+1);
cout<<res<<'\n';
}
else{
vector <ll> a(n);
ll sum = 0;
for (auto &x:a){cin>>x;sum = (sum+x)%(2*n+1);}
ll u,v;
u = random2(0,sz(a)-1);
v = random2(0,sz(a)-1);
while ((u == v || f(a[u],a[v],n) != sum)){
u = random2(0,sz(a)-1);
v = random2(0,sz(a)-1);
}
cout<<a[u]<<' '<<a[v]<<'\n';
}
}
}
/*
1
1
6
7 8 9 6 11 12
1
1
6
0 1 2 3 4 5
1
3
6
10 8 4 5
*/
詳細信息
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 0
Time Limit Exceeded
input:
12012 1 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 4 6 6 0 1 2 3 5 6 6 0 1 2 3 5 6 6 0 1 2 3 5 6 6 0 1 2 3 5 6 6 0 1 2 3 5 6 6 0 1 2 3 5 6 6 0 1 2 3 5 ...
output:
result:
Subtask #2:
score: 0
Skipped
Subtask #3:
score: 0
Time Limit Exceeded
Test #11:
score: 0
Time Limit Exceeded
input:
6525 1 6 10 1 11 3 12 6 6 1 7 10 12 5 6 6 0 10 12 7 9 8 6 12 1 8 4 7 11 6 11 8 9 4 10 6 6 0 7 2 3 4 5 6 0 8 3 10 11 6 6 0 1 2 4 7 6 6 0 1 11 9 5 6 6 7 1 12 8 6 5 7 0 1 13 10 12 5 6 7 0 14 2 3 4 12 6 7 11 1 3 8 12 6 13 7 0 1 2 3 13 5 14 7 11 9 10 8 4 14 7 7 0 8 14 3 4 13 11 7 0 10 2 14 8 5 6 7 0 13 2...
output:
result:
Subtask #4:
score: 0
Skipped