QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#323986 | #4829. Mark on a Graph | hotboy2703 | 0 | 0ms | 0kb | C++14 | 1.7kb | 2024-02-10 15:00:30 | 2024-02-10 15:00:30 |
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(chrono::steady_clock::now().time_since_epoch().count());
ll random(ll l,ll r){
return rng()%(r-l+1)+l;
}
ll myrandom(ll i){
return rng()%i;
}
ll n,m;
vector <ll> g[1010];
const ll MOD = 1e9 + 7;
ll p(ll x,ll y){
ll res = 1;
for (;y;y>>=1,x*x%MOD){
if (y&1)res = res*x%MOD;
}
return res;
}
ll f(ll x,ll y){
if (x>y)swap(x,y);
return p(2,x*(n*1)+y);
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
cin>>n>>m;
vector <pll> edge;
ll sum = 0;
for (ll i = 1;i <= m;i ++){
ll u,v;
cin>>u>>v;
sum ^= f(u,v);
}
if (sum <= 100){
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});
}
for (auto x:cur)sum^=f(x.fi,x.se);
if (sum <= 100){
ans = cur;
break;
}
for (auto x:cur)sum^=f(x.fi,x.se);
}
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
Stage 2: Program answer Time Limit Exceeded
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 816 891 344 361 937 456 164 706 851 951
input:
1000 3565 626 777 295 222 665 811 534 338 682 101 50 833 155 950 656 841 184 95 383 221 450 259 815 771 335 355 759 167 402 763 582 250 950 401 224 802 974 277 521 246 368 12 676 977 113 210 643 831 511 688 553 125 506 102 70 757 955 736 87 733 355 37 600 53 580 201 990 267 201 14 951 583 221 937 25...
output:
mark