ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#194470 | #3409. 花菖蒲 | mikefeng | 100 | 11ms | 1352kb | C++11 | 1.7kb | 2023-10-15 14:48:21 | 2023-10-15 18:47:35 |
answer
bool M1;
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<iomanip>
#include<cassert>
#include<random>
#include<cstdio>
#include<vector>
#include<bitset>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<ctime>
#include<map>
#include<set>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/hash_policy.hpp>
//#include<ext/pb_ds/priority_queue.hpp>
#define fi first
#define se second
#define LD double
#define name(x) #x
#define ll long long
#define Vector Point
#define I128 __int128
#define ull unsigned ll
#define pii pair<int,int>
#define pb(x) push_back(x)
#define dek(x) debug(x)<<" "
#define deh(x) debug(x)<<endl
#define syt cerr<<"sytakioi\n"
#define debug(x) cout<<name(x)<<":"<<x
#define F(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
#define look_memory cerr<<abs(&M2-&M1)/1024.0/1024<<'\n'
#define rd_i(l,r) uniform_int_distribution<int>(l,r)(rd)
#define rd_r(l,r) uniform_real_distribution<double>(l,r)(rd)
#define look_time cerr<<(clock()-Time)*1.0/CLOCKS_PER_SEC<<'\n'
using namespace std;
//using namespace __gnu_cxx;
mt19937 rd(time(0));
const int N=205;
int n,m;
int in[N];
bool M2;
int main(){
int Time=clock();
look_memory;
cin.tie(nullptr)->sync_with_stdio(false);
cin>>n>>m;
if(!n&&!m) cout<<"1\n";
else if(n==3&&m==1) cout<<"4\n1 2\n1 3\n1 4\n";
else if(n==3||n<m+2||n==m+3) cout<<"0\n";
else{
cout<<n+m+1<<'\n';
F(i,1,m-1) cout<<i<<' '<<i+1<<'\n',++in[i],++in[i+1];
int l=1;
F(i,1,n+1){
while(l<=m&&in[l]==3) ++l;
if(l<=m) ++in[l],cout<<l<<' '<<m+i<<'\n';
else if(i!=1) cout<<m+1<<' '<<m+i<<'\n';
}
}
look_time;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 20
Accepted
Test #1:
score: 20
Accepted
time: 0ms
memory: 1340kb
input:
0 0
output:
1
result:
ok has solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
0 0
output:
1
result:
ok has solution
Test #3:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
3 1
output:
4 1 2 1 3 1 4
result:
ok has solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
3 2
output:
0
result:
ok no solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
2 5
output:
0
result:
ok no solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
5 0
output:
6 1 2 1 3 1 4 1 5 1 6
result:
ok has solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
2 5
output:
0
result:
ok no solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
3 4
output:
0
result:
ok no solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
5 1
output:
7 1 2 1 3 1 4 2 5 2 6 2 7
result:
ok has solution
Test #10:
score: 0
Accepted
time: 1ms
memory: 1340kb
input:
3 0
output:
0
result:
ok no solution
Test #11:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
0 0
output:
1
result:
ok has solution
Test #12:
score: 0
Accepted
time: 1ms
memory: 1340kb
input:
1 0
output:
0
result:
ok no solution
Test #13:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
4 2
output:
7 1 2 1 3 1 4 2 5 2 6 3 7
result:
ok has solution
Test #14:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
0 3
output:
0
result:
ok no solution
Test #15:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
1 4
output:
0
result:
ok no solution
Subtask #2:
score: 20
Accepted
Test #16:
score: 20
Accepted
time: 0ms
memory: 1344kb
input:
0 0
output:
1
result:
ok has solution
Test #17:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
0 0
output:
1
result:
ok has solution
Test #18:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
0 0
output:
1
result:
ok has solution
Test #19:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
0 0
output:
1
result:
ok has solution
Test #20:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
0 0
output:
1
result:
ok has solution
Test #21:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
0 0
output:
1
result:
ok has solution
Test #22:
score: 0
Accepted
time: 1ms
memory: 1344kb
input:
0 0
output:
1
result:
ok has solution
Test #23:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
58 0
output:
59 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 ...
result:
ok has solution
Test #24:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
85 0
output:
86 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 ...
result:
ok has solution
Test #25:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
0 0
output:
1
result:
ok has solution
Test #26:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
90 0
output:
91 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 ...
result:
ok has solution
Test #27:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
5 0
output:
6 1 2 1 3 1 4 1 5 1 6
result:
ok has solution
Test #28:
score: 0
Accepted
time: 1ms
memory: 1344kb
input:
0 0
output:
1
result:
ok has solution
Test #29:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
70 0
output:
71 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 ...
result:
ok has solution
Test #30:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
0 0
output:
1
result:
ok has solution
Subtask #3:
score: 20
Accepted
Test #31:
score: 20
Accepted
time: 1ms
memory: 1352kb
input:
112 110
output:
223 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #32:
score: 0
Accepted
time: 1ms
memory: 1352kb
input:
161 159
output:
321 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #33:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
26 24
output:
51 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 ...
result:
ok has solution
Test #34:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
82 80
output:
163 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #35:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
2 0
output:
3 1 2 1 3
result:
ok has solution
Test #36:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
82 80
output:
163 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #37:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
172 170
output:
343 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #38:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
93 91
output:
185 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #39:
score: 0
Accepted
time: 1ms
memory: 1348kb
input:
146 144
output:
291 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #40:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
72 70
output:
143 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #41:
score: 0
Accepted
time: 1ms
memory: 1352kb
input:
23 21
output:
45 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 ...
result:
ok has solution
Test #42:
score: 0
Accepted
time: 1ms
memory: 1348kb
input:
77 75
output:
153 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #43:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
117 115
output:
233 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #44:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
166 164
output:
331 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #45:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
119 117
output:
237 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Subtask #4:
score: 30
Accepted
Test #46:
score: 30
Accepted
time: 0ms
memory: 1348kb
input:
25 1
output:
27 1 2 1 3 1 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 ...
result:
ok has solution
Test #47:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
174 170
output:
345 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #48:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
162 161
output:
0
result:
ok no solution
Test #49:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
1 1
output:
0
result:
ok no solution
Test #50:
score: 0
Accepted
time: 1ms
memory: 1340kb
input:
1 152
output:
0
result:
ok no solution
Test #51:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
174 173
output:
0
result:
ok no solution
Test #52:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
173 164
output:
338 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #53:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
73 71
output:
145 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #54:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
72 70
output:
143 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #55:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
17 33
output:
0
result:
ok no solution
Test #56:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
192 45
output:
238 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #57:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
75 158
output:
0
result:
ok no solution
Test #58:
score: 0
Accepted
time: 1ms
memory: 1344kb
input:
22 87
output:
0
result:
ok no solution
Test #59:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
163 160
output:
0
result:
ok no solution
Test #60:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
147 143
output:
291 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Subtask #5:
score: 10
Accepted
Test #61:
score: 10
Accepted
time: 0ms
memory: 1340kb
input:
0 0
output:
1
result:
ok has solution
Test #62:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
48 46
output:
95 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 ...
result:
ok has solution
Test #63:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
117 116
output:
0
result:
ok no solution
Test #64:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
40 36
output:
77 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 ...
result:
ok has solution
Test #65:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
84 47
output:
132 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #66:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
0 195
output:
0
result:
ok no solution
Test #67:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
43 39
output:
83 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 ...
result:
ok has solution
Test #68:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
0 0
output:
1
result:
ok has solution
Test #69:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
0 21
output:
0
result:
ok no solution
Test #70:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
0 8
output:
0
result:
ok no solution
Test #71:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
56 55
output:
0
result:
ok no solution
Test #72:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
105 102
output:
0
result:
ok no solution
Test #73:
score: 0
Accepted
time: 0ms
memory: 1348kb
input:
146 144
output:
291 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Test #74:
score: 0
Accepted
time: 0ms
memory: 1340kb
input:
0 28
output:
0
result:
ok no solution
Test #75:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
161 35
output:
197 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20...
result:
ok has solution
Extra Test:
score: 0
Extra Test Passed