QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#250553 | #5176. 多控制反转 | Crysfly | 0 | 1ms | 3468kb | C++17 | 1.7kb | 2023-11-13 12:35:58 | 2023-11-13 12:35:58 |
answer
// what is matter? never mind.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
//#define int long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 300005
#define inf 0x3f3f3f3f
int n;
vector<array<int,4>>out;
void add(int a,int b,int c,int d){out.pb({a,b,c,d});}
void solve(vi a,vi b,int o){
int n=a.size();
if(n==0){
add(1,b[0],-1,-1);
return;
}
if(n==1){
add(2,a[0],b[0],-1);
return;
}
if(n==2){
add(3,a[0],a[1],b[0]);
return;
}
add(3,a[0],b[1],b[0]);
vi aa=a,bb=b;
aa.erase(aa.begin());
bb.erase(bb.begin());
solve(aa,bb,1);
add(3,a[0],b[1],b[0]);
if(o==0) solve(aa,bb,1);
}
signed main()
{
n=read(),read(),read(),read();
if(n==0)puts("1"),puts("1 0"),exit(0);
if(n==1)puts("1"),puts("2 0 1"),exit(0);
For(_,0,1){
vi a,b;
For(i,0,n/2-1)a.pb(i); a.pb(n+1);
b.pb(n); For(i,n/2,n)b.pb(i);
solve(a,b,0);
a.clear(),b.clear();
For(i,n/2,n)a.pb(i);
b.pb(n+1); For(i,0,n/2-1)b.pb(i);
solve(a,b,0);
}
cout<<out.size()<<"\n";
for(auto [a,b,c,d]:out)cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
return 0;
}
/*
*/
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 15
Accepted
time: 1ms
memory: 3404kb
input:
0 2 1 1
output:
1 1 0
result:
ok OK.
Test #2:
score: -15
Wrong Answer
time: 1ms
memory: 3356kb
input:
13 28 105 1
output:
88 3 0 6 13 3 1 7 6 3 2 8 7 3 3 9 8 3 4 10 9 3 5 14 10 3 4 10 9 3 3 9 8 3 2 8 7 3 1 7 6 3 0 6 13 3 1 7 6 3 2 8 7 3 3 9 8 3 4 10 9 3 5 14 10 3 4 10 9 3 3 9 8 3 2 8 7 3 1 7 6 3 6 0 14 3 7 1 0 3 8 2 1 3 9 3 2 3 10 4 3 3 11 5 4 3 12 13 5 3 11 5 4 3 10 4 3 3 9 3 2 3 8 2 1 3 7 1 0 3 6 0 14 3 7 1 0 3 8 2 1...
result:
wrong answer Wrong solution.
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: 3432kb
input:
0 2 1 4
output:
1 1 0
result:
ok OK.
Test #14:
score: -10
Wrong Answer
time: 1ms
memory: 3468kb
input:
18 20 325 4
output:
128 3 0 9 18 3 1 10 9 3 2 11 10 3 3 12 11 3 4 13 12 3 5 14 13 3 6 15 14 3 7 16 15 3 8 19 16 3 7 16 15 3 6 15 14 3 5 14 13 3 4 13 12 3 3 12 11 3 2 11 10 3 1 10 9 3 0 9 18 3 1 10 9 3 2 11 10 3 3 12 11 3 4 13 12 3 5 14 13 3 6 15 14 3 7 16 15 3 8 19 16 3 7 16 15 3 6 15 14 3 5 14 13 3 4 13 12 3 3 12 11 3...
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: 3440kb
input:
14 16 393 6
output:
96 3 0 7 14 3 1 8 7 3 2 9 8 3 3 10 9 3 4 11 10 3 5 12 11 3 6 15 12 3 5 12 11 3 4 11 10 3 3 10 9 3 2 9 8 3 1 8 7 3 0 7 14 3 1 8 7 3 2 9 8 3 3 10 9 3 4 11 10 3 5 12 11 3 6 15 12 3 5 12 11 3 4 11 10 3 3 10 9 3 2 9 8 3 1 8 7 3 7 0 15 3 8 1 0 3 9 2 1 3 10 3 2 3 11 4 3 3 12 5 4 3 13 14 5 3 12 5 4 3 11 4 3...
result:
wrong answer Wrong solution.
Subtask #7:
score: 0
Skipped
Dependency #2:
0%
Subtask #8:
score: 0
Skipped
Dependency #3:
0%