QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#426441#6319. Parallel Processing (Easy)james1BadCreeperWA 0ms3720kbC++172.2kb2024-05-31 11:17:282024-05-31 11:17:29

Judging History

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

  • [2024-05-31 11:17:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3720kb
  • [2024-05-31 11:17:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int id, n, I, be = 5; 
vector<tuple<int, int, int>> ans; 

inline int get(int x) {
    if (x % 4 == 1) return x - 1; 
    if (x % 4 == 2) return x - 2; 
    if (x % 4 == 3) return x - 3; 
    return x - 4; 
}

int over = 4; 
inline void mkans(void) {
    if (get(be) <= over && be < I) {
        ans.emplace_back(be, get(be), be); 
        ++be; 
    } else ans.emplace_back(2000, 2000, 2000); 
}

int main(void) {
    ios::sync_with_stdio(0); 
    // cin >> id >> n; 
    cin >> n; 
    int I, be = 5; 
    for (I = 1; I + 3 - 1 <= n; I += 8) {
        ans.emplace_back(I + 1, I, I + 1); 
        if (I + 3 <= n) ans.emplace_back(I + 3, I + 2, I + 3); 
        else mkans(); 
        if (I + 1 + 4 <= n) ans.emplace_back(I + 1 + 4, I + 4, I + 1 + 4); 
        else mkans(); 
        if (I + 3 + 4 <= n) ans.emplace_back(I + 3 + 4, I + 2 + 4, I + 3 + 4); 
        else mkans(); 
        over = be; 

        ans.emplace_back(I + 2, I + 1, I + 2);  
        if (I + 3 <= n) ans.emplace_back(I + 3, I + 1, I + 3);  
        else mkans(); 
        if (I + 2 + 4 <= n) ans.emplace_back(I + 2 + 4, I + 1 + 4, I + 2 + 4); 
        else mkans(); 
        if (I + 3 + 4 <= n) ans.emplace_back(I + 3 + 4, I + 1 + 4, I + 3 + 4); 
        else mkans(); 
        over = be; 
    }
    if (I < n) {
        ans.emplace_back(I + 1, I, I + 1); 
        mkans(); mkans(); mkans(); over = be; 
    }
    // cerr << ans.size() << "\n"; 
    int cnt = 0; 
    while (be % 4 != 1) ans.emplace_back(be, get(be), be), ++be, ++cnt; 
    while (cnt != 0 && cnt != 4) ans.emplace_back(2000, 2000, 2000), ++cnt; 
    for (; be <= n; be += 4) {
        ans.emplace_back(be, get(be), be); 
        if (be + 1 <= n) ans.emplace_back(be + 1, get(be + 1), be + 1);  
        else ans.emplace_back(2000, 2000, 2000); 
        if (be + 2 <= n) ans.emplace_back(be + 2, get(be + 2), be + 2); 
        else ans.emplace_back(2000, 2000, 2000); 
        if (be + 3 <= n) ans.emplace_back(be + 3, get(be + 3), be + 3); 
        else ans.emplace_back(2000, 2000, 2000); 
    }
    cout << ans.size() / 4 << "\n"; 
    for (auto [i, j, k] : ans) cout << i << " " << j << " " << k << "\n"; 
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2

output:

1
2 1 2
2000 2000 2000
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #2:

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

input:

4

output:

2
2 1 2
4 3 4
2000 2000 2000
2000 2000 2000
3 2 3
4 2 4
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #3:

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

input:

3

output:

2
2 1 2
2000 2000 2000
2000 2000 2000
2000 2000 2000
3 2 3
2000 2000 2000
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #4:

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

input:

5

output:

3
2 1 2
4 3 4
2000 2000 2000
2000 2000 2000
3 2 3
4 2 4
2000 2000 2000
2000 2000 2000
5 4 5
2000 2000 2000
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #5:

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

input:

6

output:

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

result:

ok AC

Test #6:

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

input:

7

output:

3
2 1 2
4 3 4
6 5 6
2000 2000 2000
3 2 3
4 2 4
7 6 7
2000 2000 2000
5 4 5
6 4 6
7 4 7
2000 2000 2000

result:

ok AC

Test #7:

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

input:

8

output:

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

result:

ok AC

Test #8:

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

input:

9

output:

4
2 1 2
4 3 4
6 5 6
8 7 8
3 2 3
4 2 4
7 6 7
8 6 8
5 4 5
6 4 6
7 4 7
8 4 8
9 8 9
2000 2000 2000
2000 2000 2000
2000 2000 2000

result:

ok AC

Test #9:

score: -100
Wrong Answer
time: 0ms
memory: 3704kb

input:

10

output:

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

result:

wrong answer L = 5 is larger than 4