QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#123792#5176. 多控制反转pandapythoner#0 1ms3728kbC++142.3kb2023-07-13 17:24:422024-07-04 00:37:41

Judging History

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

  • [2024-07-04 00:37:41]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3728kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-13 17:24:42]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define flt double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()


#ifdef LOCAL
// #define _GLIBCXX_DEBUG
bool local = true;
#else
bool local = false;
#endif


mt19937 rnd(234);
const ll inf = 1e18;


struct operation{
    int t, x, y, z;


    operation(){}
    operation(int t, int x, int y, int z) : t(t), x(x), y(y), z(z) {}
};


ostream& operator<<(ostream &out, operation &op){
    out << op.t << " " << op.x;
    if(op.t >= 2){
        out << " " << op.y;
    }
    if(op.t >= 3){
        out << " " << op.z;
    }
    return out;
}


int n, m, Q, subgroup;
vector<operation> rs;


void add_op(int t, int x, int y = 0, int z = 0){
    rs.emplace_back(t, x, y, z);
}


void solve_12(){
    rs.clear();
    add_op(2, 0, n + 1);
    for(int i = 1; i < n; i += 1){
        add_op(3, i, n + i, n + i + 1);
    }
    add_op(2, 2 * n, n);
    for(int i = n - 1; i >= 1; i -= 1){
        add_op(3, i, n + i, n + i + 1);
    }
    add_op(2, 0, n + 1);
}


vector<int> make_operations(vector<int> t){
    for(auto op: rs){
        if(op.t == 1){
            t[op.x] ^= 1;
        } else if(op.t == 2 && t[op.x]){
            t[op.y] ^= 1;
        } else if(op.t == 3 && t[op.x] && t[op.y]){
            t[op.z] ^= 1;
        }
    }
    return t;
}


int32_t main(){
    if(!local){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }
    int t = 1;
    if(local){
        t = 1000;
    }
    while(t--){
        cin >> n >> m >> Q >> subgroup;
        vector<int> t(m);
        if(local){
            for(int i = 0; i < m; i += 1){
                cin >> t[i];
            }
        }
        if(n == 0){
            rs.clear();
            add_op(1, 0);
        } if(subgroup == 1 || subgroup == 2){
            solve_12();
        }
        cout << rs.size() << "\n";
        for(auto x: rs){
            cout << x << "\n";
        }
        if(local){
            auto nt = make_operations(t);
            for(int i = 0; i < m; i += 1){
                cout << nt[i] << " ";
            }
            cout << "\n";
        }
    }
    return 0;
}



/*
2 6 100 1
0 1 1 0 0 0


*/

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3592kb

input:

0 2 1 1

output:

3
2 0 1
2 0 0
2 0 1

result:

wrong answer Integer 3 violates the range [0, 1]

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #13:

score: 10
Accepted
time: 1ms
memory: 3572kb

input:

0 2 1 4

output:

1
1 0

result:

ok OK.

Test #14:

score: 0
Wrong Answer
time: 1ms
memory: 3472kb

input:

18 20 325 4

output:

0

result:

wrong answer Wrong solution.

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Wrong Answer

Test #20:

score: 0
Wrong Answer
time: 1ms
memory: 3728kb

input:

14 16 393 6

output:

0

result:

wrong answer Wrong solution.

Subtask #7:

score: 0
Skipped

Dependency #2:

0%

Subtask #8:

score: 0
Skipped

Dependency #3:

0%