QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#320891 | #8215. Isomorphic Delight | ucup-team087# | WA | 1ms | 3944kb | C++14 | 2.2kb | 2024-02-03 23:20:51 | 2024-02-03 23:20:52 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
int N;
vector<int> A, B;
void init() {
A.clear();
B.clear();
}
void ae(int u, int v) {
A.push_back(u);
B.push_back(v);
}
bool solve() {
init();
if (N == 1) {
return true;
} else if (N <= 5) {
return false;
} else if (N == 6) {
ae(0, 1);
ae(1, 2);
ae(2, 0);
ae(1, 3);
ae(2, 4);
ae(4, 5);
return true;
} else {
const int n = (N == 7) ? N : (N - 1);
ae(0, 1);
ae(0, 2);
ae(2, 3);
{
int p = 0;
for (int u = 4; u < n; ++u) {
ae(p, u);
p = u;
}
}
return true;
}
}
int main() {
for (; ~scanf("%d", &N); ) {
const bool res = solve();
if (res) {
const int M = A.size();
puts("YES");
printf("%d\n", M);
for (int i = 0; i < M; ++i) {
printf("%d %d\n", A[i] + 1, B[i] + 1);
}
} else {
puts("NO");
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3944kb
input:
1
output:
YES 0
result:
ok Everything ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
6
output:
YES 6 1 2 2 3 3 1 2 4 3 5 5 6
result:
ok Everything ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
4
output:
NO
result:
ok Everything ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2
output:
NO
result:
ok Everything ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
3
output:
NO
result:
ok Everything ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
5
output:
NO
result:
ok Everything ok
Test #7:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
7
output:
YES 6 1 2 1 3 3 4 1 5 5 6 6 7
result:
ok Everything ok
Test #8:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
8
output:
YES 6 1 2 1 3 3 4 1 5 5 6 6 7
result:
ok Everything ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
9
output:
YES 7 1 2 1 3 3 4 1 5 5 6 6 7 7 8
result:
ok Everything ok
Test #10:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
10
output:
YES 8 1 2 1 3 3 4 1 5 5 6 6 7 7 8 8 9
result:
ok Everything ok
Test #11:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
11
output:
YES 9 1 2 1 3 3 4 1 5 5 6 6 7 7 8 8 9 9 10
result:
ok Everything ok
Test #12:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
12
output:
YES 10 1 2 1 3 3 4 1 5 5 6 6 7 7 8 8 9 9 10 10 11
result:
ok Everything ok
Test #13:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
13
output:
YES 11 1 2 1 3 3 4 1 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12
result:
ok Everything ok
Test #14:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
14
output:
YES 12 1 2 1 3 3 4 1 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13
result:
ok Everything ok
Test #15:
score: 0
Accepted
time: 1ms
memory: 3892kb
input:
15
output:
YES 13 1 2 1 3 3 4 1 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14
result:
ok Everything ok
Test #16:
score: -100
Wrong Answer
time: 0ms
memory: 3748kb
input:
16
output:
YES 14 1 2 1 3 3 4 1 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15
result:
wrong answer contestant's solution is worse (more edges) than jury's