QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#293814 | #4829. Mark on a Graph | ucup-team266# | 0 | 0ms | 0kb | C++14 | 2.3kb | 2023-12-29 19:49:22 | 2023-12-29 19:49:22 |
answer
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef array<int, 3> ai3;
const int inf = 0x3f3f3f3f;
const int Mod = 998244353;
const int inv[5] = {0, 1, (Mod+1) / 2, (Mod+1) / 3};
inline int sign(int a){ return (a&1) ? (Mod-1) : 1; }
inline void uadd(int &a, int b){ a += b-Mod; a += (a>>31) & Mod; }
inline void usub(int &a, int b){ a -= b, a += (a>>31) & Mod; }
inline void umul(int &a, int b){ a = (int)(1ll * a * b % Mod); }
inline int add(int a, int b){ a += b-Mod; a += (a>>31) & Mod; return a; }
inline int sub(int a, int b){ a -= b, a += (a>>31) & Mod; return a; }
inline int mul(int a, int b){ a = (int)(1ll * a * b % Mod); return a; }
int qpow(int b, ll p){ int ret = 1; while(p){ if(p&1) umul(ret, b); umul(b, b), p >>= 1; } return ret; }
const int fN = 1616;
int fact[fN], invfact[fN], pw2[fN], invpw2[fN];
void initfact(int n){
pw2[0] = 1; for(int i = 1; i <= n; ++i) pw2[i] = mul(pw2[i-1], 2);
invpw2[0] = 1; for(int i = 1; i <= n; ++i) invpw2[i] = mul(invpw2[i-1], (Mod+1) / 2);
fact[0] = 1; for(int i = 1; i <= n; ++i) fact[i] = mul(fact[i-1], i);
invfact[n] = qpow(fact[n], Mod-2); for(int i = n; i > 0; --i) invfact[i-1] = mul(invfact[i], i);
}
int binom(int n, int m){ return (m < 0 || m > n) ? 0 : mul(fact[n], mul(invfact[m], invfact[n-m])); }
const double pi = acos(-1);
inline void chmax(int &a, int b){ (b>a) ? (a=b) : 0; }
inline void chmin(int &a, int b){ (b<a) ? (a=b) : 0; }
int n, m;
int has[1010][1010], deg[1010];
int main(){
freopen("001.phase1.full.input", "r", stdin);
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
rep(i, m){
int u, v;
cin >> u >> v;
--u, --v;
has[u][v] = has[v][u] = 1;
++deg[u], ++deg[v];
}
static int ord[1010];
rep(i, n) ord[i] = i;
sort(ord, ord + n, [&](int lh, int rh){ return deg[lh] > deg[rh]; });
int cc = 0;
rep(i, 5){
rep(j, i)
cc += has[ord[i]][ord[j]];
}
if(cc < 5){
cout << "mark" << endl << "5" << endl;
int k = 5;
rep(i, 5) rep(j, i){
if(k && !has[ord[i]][ord[j]])
cout << ord[i]+1 << " " << ord[j]+1 << endl, --k;
}
} else {
cout << "ok" << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer on the first run
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 1 1 1 1 1 1 1 1 1 1
input:
output:
result:
wrong answer operation 1: 1 1