QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#324014 | #4829. Mark on a Graph | hotboy2703 | 0 | 66ms | 12236kb | C++14 | 1.9kb | 2024-02-10 15:12:32 | 2024-02-10 15:12:37 |
Judging History
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);
ll random(ll l,ll r){
return rng()%(r-l+1)+l;
}
ll myrandom(ll i){
return rng()%i;
}
ll n,m;
ll val[1010][1010];
struct graph{
set <pll> s;
void add_edge(ll u,ll v){
if (u > v)swap(u,v);
if (s.find({u,v})==s.end())s.insert({u,v});
else s.erase({u,v});
}
ll cnt[1010];
ll eval(){
memset(cnt,0,sizeof cnt);
for (auto x:s)cnt[x.fi]++,cnt[x.se]++;
ll res = 0;
for (auto x:s){
res ^= val[x.fi][x.se];
}
return res;
}
};
int main(){
ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
for (ll i = 1;i <= 1000;i ++){
for (ll j = 1;j <= 1000;j ++){
val[i][j] = random(0,1023);
}
}
cin>>n>>m;
graph g;
for (ll i = 1;i <= m;i ++){
ll u,v;
cin>>u>>v;
g.add_edge(u,v);
}
if (g.eval() == 69){
cout<<"ok"<<endl;
}
else{
cout<<"mark"<<endl;
vector <pll> ans;
while (1){
vector <pll> cur;
for (ll i = 0;i < 5;i++){
ll u,v;
u = random(1,n),v = random(1,n);
while (u==v)u = random(1,n),v = random(1,n);
cur.push_back({u,v});
}
graph tmp = g;
for (auto x:cur){
tmp.add_edge(x.fi,x.se);
}
if (tmp.eval()==69){
ans = cur;
break;
}
}
cout<<sz(ans)<<'\n';
for (auto x:ans)cout<<x.fi<<' '<<x.se<<'\n';;
}
// cout<<even<<'\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 66ms
memory: 12236kb
input:
1000 3560 603 151 415 20 102 569 895 552 678 734 24 614 689 518 440 223 751 919 223 433 711 551 502 634 706 583 812 501 514 535 780 751 720 530 532 384 888 139 864 791 292 675 171 881 30 592 464 557 280 299 654 650 894 335 250 532 792 10 83 969 118 771 579 300 852 983 243 940 957 939 817 889 911 319...
output:
mark 5 216 589 623 976 5 717 731 987 792 988
input:
1000 3565 626 777 295 222 665 811 534 338 682 101 706 833 155 950 656 841 184 95 383 221 86 259 815 771 37 355 759 167 402 763 582 250 950 401 224 881 974 22 521 380 368 12 676 977 113 210 643 831 511 688 553 125 506 102 70 757 246 736 87 733 956 373 600 53 790 201 990 267 201 580 951 583 557 937 42...
output:
mark 5 155 577 755 367 791 461 259 250 108 896
result:
wrong answer Token "mark" doesn't correspond to pattern "ok"