QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#692771#8934. Challenge NPCendeavorHao#AC ✓18ms6284kbC++142.4kb2024-10-31 15:01:192024-10-31 15:01:21

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 15:01:21]
  • 评测
  • 测评结果:AC
  • 用时:18ms
  • 内存:6284kb
  • [2024-10-31 15:01:19]
  • 提交

answer

#pragma GCC optimize(3, "Ofast", "inline")
#include<bits/stdc++.h>
#define int long long
#define fr first 
#define sc second 
#define DEBUG_
#ifdef DEBUG_
#define dbg(a) std::cerr << #a << ':' << a << '\n'
template<class T>
void print_(T &t) {
   std::cerr << t << '\n';
}
template<class T, class... Args>
void print_(T &t, Args&... args) {
   std::cerr << t << ' ';
   print_(args...);
}
#else
#define dbg(a)
template<class T>
void print_(T &t) {
}
template<class T, class... Args>
void print_(T &t, Args&... args) {
}
#endif
#define rep(i, a, b) for(int i = (a);i <= (b); ++i)
#define per(i, a, b) for(int i = (a);i >= (b); --i)
#define pb push_back
#define eb emplace_back
#define mem(a, b) memset(a, b, sizeof a)
#define ls(x) (x << 1)
#define rs(x) (x << 1 | 1)
#define lowbit(x) (x & -x)
#define PY puts("YES")
#define Py puts("Yes")
#define PN puts("NO")
#define Pn puts("No")
#define all(x, l, r) x.begin() + l, x.begin() + r + 1
//using namespace std;
const int N = 1e6 + 10;
const int M = 320;
const int INF = 1e18 + 10;
// const int mod = 998244353;
const int mod = 1e9 + 7;
const int base1 = 131;
const int base2 = 13331;
using PII = std::pair<int, int>;
using ull = unsigned long long;
using ll = long long;
using std::array;
using std::cin;
using std::cout;
using std::vector;
template <class T>
using pq_g = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T>
using pq_ = std::priority_queue<T>;

int n;
int m;

void solve() {
    cin >> m;
    n = 2 * (m + 2);
    int tot = 0;
    vector<vector<int>> edge(n + 1);
    for(int i = 1; i <= n; i++) {
        if (i % 2) {
            for(int j = i + 3; j <= n; j += 2) {
                edge[i].pb(j);
                tot++;
            }
        } else {
            for(int j = i + 1; j <= n; j += 2) {
                edge[i].pb(j);
                tot++;
            }
        }
    }
    cout << n << ' ' << tot << ' ' << 2 << '\n';
    for(int i = 1; i <= n; i++) {
        if (i % 2) cout << "1 ";
        else cout << "2 "; 
    }
    cout << '\n';
    rep(i, 1, n) {
        for(auto& j : edge[i]) {
            cout << i << ' ' << j << '\n';
        }
    }
}

signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0), std::cout.tie(0);
    int _ = 1;
    // std::cin >> _;
    while (_--) {
        solve();
    }
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3648kb

input:

1

output:

6 6 2
1 2 1 2 1 2 
1 4
1 6
2 3
2 5
3 6
4 5

result:

ok ok

Test #2:

score: 0
Accepted
time: 0ms
memory: 3500kb

input:

2

output:

8 12 2
1 2 1 2 1 2 1 2 
1 4
1 6
1 8
2 3
2 5
2 7
3 6
3 8
4 5
4 7
5 8
6 7

result:

ok ok

Test #3:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

3

output:

10 20 2
1 2 1 2 1 2 1 2 1 2 
1 4
1 6
1 8
1 10
2 3
2 5
2 7
2 9
3 6
3 8
3 10
4 5
4 7
4 9
5 8
5 10
6 7
6 9
7 10
8 9

result:

ok ok

Test #4:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

4

output:

12 30 2
1 2 1 2 1 2 1 2 1 2 1 2 
1 4
1 6
1 8
1 10
1 12
2 3
2 5
2 7
2 9
2 11
3 6
3 8
3 10
3 12
4 5
4 7
4 9
4 11
5 8
5 10
5 12
6 7
6 9
6 11
7 10
7 12
8 9
8 11
9 12
10 11

result:

ok ok

Test #5:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

5

output:

14 42 2
1 2 1 2 1 2 1 2 1 2 1 2 1 2 
1 4
1 6
1 8
1 10
1 12
1 14
2 3
2 5
2 7
2 9
2 11
2 13
3 6
3 8
3 10
3 12
3 14
4 5
4 7
4 9
4 11
4 13
5 8
5 10
5 12
5 14
6 7
6 9
6 11
6 13
7 10
7 12
7 14
8 9
8 11
8 13
9 12
9 14
10 11
10 13
11 14
12 13

result:

ok ok

Test #6:

score: 0
Accepted
time: 14ms
memory: 5692kb

input:

433

output:

870 188790 2
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

result:

ok ok

Test #7:

score: 0
Accepted
time: 15ms
memory: 6244kb

input:

500

output:

1004 251502 2
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...

result:

ok ok

Test #8:

score: 0
Accepted
time: 9ms
memory: 6284kb

input:

499

output:

1002 250500 2
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...

result:

ok ok

Test #9:

score: 0
Accepted
time: 15ms
memory: 5988kb

input:

457

output:

918 210222 2
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

result:

ok ok

Test #10:

score: 0
Accepted
time: 18ms
memory: 6268kb

input:

497

output:

998 248502 2
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

result:

ok ok

Extra Test:

score: 0
Extra Test Passed