QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#426428#6319. Parallel Processing (Easy)james1BadCreeperWA 0ms3656kbC++173.1kb2024-05-31 10:55:372024-05-31 10:55:37

Judging History

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

  • [2024-05-31 10:55:37]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3656kb
  • [2024-05-31 10:55:37]
  • 提交

answer

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

int id, n; 
vector<tuple<int, int, int>> ans; 

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 main(void) {
    ios::sync_with_stdio(0); 
    cin >> id >> 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 {
            if (be < I) ans.emplace_back(be, get(be), be), ++be; 
            else ans.emplace_back(2000, 2000, 2000); 
        }
        if (I + 1 + 4 <= n) ans.emplace_back(I + 1 + 4, I + 4, I + 1 + 4); 
        else {
            if (be < I) ans.emplace_back(be, get(be), be), ++be; 
            else ans.emplace_back(2000, 2000, 2000); 
        }
        if (I + 3 + 4 <= n) ans.emplace_back(I + 3 + 4, I + 2 + 4, I + 3 + 4); 
        else {
            if (be < I) ans.emplace_back(be, get(be), be), ++be; 
            else ans.emplace_back(2000, 2000, 2000); 
        }

        ans.emplace_back(I + 2, I + 1, I + 2);  
        if (I + 3 <= n) ans.emplace_back(I + 3, I + 1, I + 3);  
        else {
            if (be < I) ans.emplace_back(be, get(be), be), ++be; 
            else ans.emplace_back(2000, 2000, 2000); 
        }
        if (I + 2 + 4 <= n) ans.emplace_back(I + 2 + 4, I + 1 + 4, I + 2 + 4); 
        else {
            if (be < I) ans.emplace_back(be, get(be), be), ++be; 
            else ans.emplace_back(2000, 2000, 2000); 
        }
        if (I + 3 + 4 <= n) ans.emplace_back(I + 3 + 4, I + 1 + 4, I + 3 + 4); 
        else {
            if (be < I) ans.emplace_back(be, get(be), be), ++be; 
            else ans.emplace_back(2000, 2000, 2000); 
        }
    }
    if (I < n) {
        ans.emplace_back(I + 1, I, I + 1); 
        if (I + 2 <= n) 
            ans.emplace_back(I + 2, I, I + 2), 
            ans.emplace_back(I + 2, I + 1, I + 2); 
        else {
            if (be < I) ans.emplace_back(be, get(be), be), ++be; 
            else ans.emplace_back(2000, 2000, 2000); 
            if (be < I) ans.emplace_back(be, get(be), be), ++be; 
            else ans.emplace_back(2000, 2000, 2000); 
        }
        if (be < I) ans.emplace_back(be, get(be), be), ++be; 
        else ans.emplace_back(2000, 2000, 2000); 
    }
    // 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: 0
Wrong Answer
time: 0ms
memory: 3656kb

input:

2

output:

0

result:

wrong answer A[2] is not (1, …, 2)