ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#194479 | #3409. 花菖蒲 | Zeardoe | 100 | 7ms | 1284kb | C++11 | 2.7kb | 2023-10-15 15:07:55 | 2023-10-15 18:48:07 |
answer
/*
[templates]:
duipai
spjdp
compre
addhis
floor_sum
treedfs
matrix
network_flow
polynomial
lca
bitset
valuesgt
fenwick
erbitree
*/
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
#include<bits/stdc++.h>
using namespace std;
#define int long long
//use ll instead of int.
#define f(i, a, b) for(int i = (a); i <= (b); i++)
#define cl(i, n) i.clear(),i.resize(n);
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int inf = 1e18;
//#define cerr if(false)cerr
//#define freopen if(false)freopen
mt19937 rng(time(0));
int rnd(int l, int r) {return rng() % (r-l+1) + l; }
#define watch(x) cerr << (#x) << ' '<<'i'<<'s'<<' ' << x << endl
void pofe(int number, int bitnum) {
string s; f(i, 0, bitnum) {s += char(number & 1) + '0'; number >>= 1; }
reverse(s.begin(), s.end()); cerr << s << endl;
return;
}
template <typename TYP> void cmax(TYP &x, TYP y) {if(x < y) x = y;}
template <typename TYP> void cmin(TYP &x, TYP y) {if(x > y) x = y;}
//调不出来给我对拍!
//use std::array.
vector<int> vec;
int deg[20020];
void solve() {
sort(vec.begin(), vec.end(), greater<int>());
cout << vec.size() << endl;
int cnt = 0, cur = 1;
for(int i : vec) {
cnt ++;
int tmp = i - deg[cnt];
f(j, 1, tmp) {
deg[cnt] ++;
deg[cur + 1] ++;
cout << cnt << " " << cur + 1 << endl;
cur ++;
}
}
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
//freopen();
//freopen();
//time_t start = clock();
//think twice,code once.
//think once,debug forever.
int a, b; cin >> a >> b;
if(a == 0 && b == 0) {
cout << 1 << endl;
return 0;
}
else if((a + b) % 2 == 0) {
if(a - 2 < b) {
cout << 0 << endl;
return 0;
}
else {
int c = (a - 2 - b) / 2;
f(i, 1, a) vec.push_back(1);
f(i, 1, b) vec.push_back(3);
f(i, 1, c) vec.push_back(4);
solve();
}
}
else {
if(a - 5 < b) {
cout << 0 << endl;
return 0;
}
else {
int c = (a - 5 - b) / 2;
vec.push_back(5);
f(i, 1, a) vec.push_back(1);
f(i, 1, b) vec.push_back(3);
f(i, 1, c) vec.push_back(4);
solve();
}
}
//time_t finish = clock();
//cout << "time used:" << (finish-start) * 1.0 / CLOCKS_PER_SEC <<"s"<< endl;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 20
Accepted
Test #1:
score: 20
Accepted
time: 0ms
memory: 1260kb
input:
0 0
output:
1
result:
ok has solution
Test #2:
score: 0
Accepted
time: 1ms
memory: 1260kb
input:
0 0
output:
1
result:
ok has solution
Test #3:
score: 0
Accepted
time: 0ms
memory: 1272kb
input:
3 1
output:
4 1 2 1 3 1 4
result:
ok has solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
3 2
output:
0
result:
ok no solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
2 5
output:
0
result:
ok no solution
Test #6:
score: 0
Accepted
time: 1ms
memory: 1272kb
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: 1260kb
input:
2 5
output:
0
result:
ok no solution
Test #8:
score: 0
Accepted
time: 1ms
memory: 1260kb
input:
3 4
output:
0
result:
ok no solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 1272kb
input:
5 1
output:
7 1 2 1 3 1 4 1 5 2 6 2 7
result:
ok has solution
Test #10:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
3 0
output:
0
result:
ok no solution
Test #11:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
0 0
output:
1
result:
ok has solution
Test #12:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
1 0
output:
0
result:
ok no solution
Test #13:
score: 0
Accepted
time: 0ms
memory: 1276kb
input:
4 2
output:
6 1 2 1 3 1 4 2 5 2 6
result:
ok has solution
Test #14:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
0 3
output:
0
result:
ok no solution
Test #15:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
1 4
output:
0
result:
ok no solution
Subtask #2:
score: 20
Accepted
Test #16:
score: 20
Accepted
time: 0ms
memory: 1260kb
input:
0 0
output:
1
result:
ok has solution
Test #17:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
0 0
output:
1
result:
ok has solution
Test #18:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
0 0
output:
1
result:
ok has solution
Test #19:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
0 0
output:
1
result:
ok has solution
Test #20:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
0 0
output:
1
result:
ok has solution
Test #21:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
0 0
output:
1
result:
ok has solution
Test #22:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
0 0
output:
1
result:
ok has solution
Test #23:
score: 0
Accepted
time: 0ms
memory: 1272kb
input:
58 0
output:
86 1 2 1 3 1 4 1 5 2 6 2 7 2 8 3 9 3 10 3 11 4 12 4 13 4 14 5 15 5 16 5 17 6 18 6 19 6 20 7 21 7 22 ...
result:
ok has solution
Test #24:
score: 0
Accepted
time: 0ms
memory: 1272kb
input:
85 0
output:
126 1 2 1 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 11 3 12 4 13 4 14 4 15 5 16 5 17 5 18 6 19 6 20 6 21 7 22...
result:
ok has solution
Test #25:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
0 0
output:
1
result:
ok has solution
Test #26:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
90 0
output:
134 1 2 1 3 1 4 1 5 2 6 2 7 2 8 3 9 3 10 3 11 4 12 4 13 4 14 5 15 5 16 5 17 6 18 6 19 6 20 7 21 7 22...
result:
ok has solution
Test #27:
score: 0
Accepted
time: 0ms
memory: 1276kb
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: 0ms
memory: 1264kb
input:
0 0
output:
1
result:
ok has solution
Test #29:
score: 0
Accepted
time: 0ms
memory: 1276kb
input:
70 0
output:
104 1 2 1 3 1 4 1 5 2 6 2 7 2 8 3 9 3 10 3 11 4 12 4 13 4 14 5 15 5 16 5 17 6 18 6 19 6 20 7 21 7 22...
result:
ok has solution
Test #30:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
0 0
output:
1
result:
ok has solution
Subtask #3:
score: 20
Accepted
Test #31:
score: 20
Accepted
time: 0ms
memory: 1280kb
input:
112 110
output:
222 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #32:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
161 159
output:
320 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #33:
score: 0
Accepted
time: 1ms
memory: 1272kb
input:
26 24
output:
50 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 2...
result:
ok has solution
Test #34:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
82 80
output:
162 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #35:
score: 0
Accepted
time: 0ms
memory: 1276kb
input:
2 0
output:
2 1 2
result:
ok has solution
Test #36:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
82 80
output:
162 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #37:
score: 0
Accepted
time: 0ms
memory: 1284kb
input:
172 170
output:
342 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #38:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
93 91
output:
184 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #39:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
146 144
output:
290 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #40:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
72 70
output:
142 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #41:
score: 0
Accepted
time: 1ms
memory: 1276kb
input:
23 21
output:
44 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 2...
result:
ok has solution
Test #42:
score: 0
Accepted
time: 0ms
memory: 1276kb
input:
77 75
output:
152 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #43:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
117 115
output:
232 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #44:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
166 164
output:
330 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #45:
score: 0
Accepted
time: 1ms
memory: 1276kb
input:
119 117
output:
236 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Subtask #4:
score: 30
Accepted
Test #46:
score: 30
Accepted
time: 0ms
memory: 1276kb
input:
25 1
output:
37 1 2 1 3 1 4 1 5 2 6 2 7 2 8 3 9 3 10 3 11 4 12 4 13 4 14 5 15 5 16 5 17 6 18 6 19 6 20 7 21 7 22 ...
result:
ok has solution
Test #47:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
174 170
output:
345 1 2 1 3 1 4 1 5 2 6 2 7 3 8 3 9 4 10 4 11 5 12 5 13 6 14 6 15 7 16 7 17 8 18 8 19 9 20 9 21 10 2...
result:
ok has solution
Test #48:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
162 161
output:
0
result:
ok no solution
Test #49:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
1 1
output:
0
result:
ok no solution
Test #50:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
1 152
output:
0
result:
ok no solution
Test #51:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
174 173
output:
0
result:
ok no solution
Test #52:
score: 0
Accepted
time: 1ms
memory: 1280kb
input:
173 164
output:
340 1 2 1 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 11 3 12 4 13 4 14 5 15 5 16 6 17 6 18 7 19 7 20 8 21 8 22...
result:
ok has solution
Test #53:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
73 71
output:
144 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #54:
score: 0
Accepted
time: 0ms
memory: 1276kb
input:
72 70
output:
142 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #55:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
17 33
output:
0
result:
ok no solution
Test #56:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
192 45
output:
309 1 2 1 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 11 3 12 4 13 4 14 4 15 5 16 5 17 5 18 6 19 6 20 6 21 7 22...
result:
ok has solution
Test #57:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
75 158
output:
0
result:
ok no solution
Test #58:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
22 87
output:
0
result:
ok no solution
Test #59:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
163 160
output:
0
result:
ok no solution
Test #60:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
147 143
output:
291 1 2 1 3 1 4 1 5 2 6 2 7 3 8 3 9 4 10 4 11 5 12 5 13 6 14 6 15 7 16 7 17 8 18 8 19 9 20 9 21 10 2...
result:
ok has solution
Subtask #5:
score: 10
Accepted
Test #61:
score: 10
Accepted
time: 0ms
memory: 1264kb
input:
0 0
output:
1
result:
ok has solution
Test #62:
score: 0
Accepted
time: 0ms
memory: 1276kb
input:
48 46
output:
94 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 2...
result:
ok has solution
Test #63:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
117 116
output:
0
result:
ok no solution
Test #64:
score: 0
Accepted
time: 0ms
memory: 1276kb
input:
40 36
output:
77 1 2 1 3 1 4 1 5 2 6 2 7 3 8 3 9 4 10 4 11 5 12 5 13 6 14 6 15 7 16 7 17 8 18 8 19 9 20 9 21 10 22...
result:
ok has solution
Test #65:
score: 0
Accepted
time: 0ms
memory: 1280kb
input:
84 47
output:
148 1 2 1 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 11 3 12 4 13 4 14 4 15 5 16 5 17 5 18 6 19 6 20 6 21 7 22...
result:
ok has solution
Test #66:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
0 195
output:
0
result:
ok no solution
Test #67:
score: 0
Accepted
time: 0ms
memory: 1272kb
input:
43 39
output:
83 1 2 1 3 1 4 1 5 2 6 2 7 3 8 3 9 4 10 4 11 5 12 5 13 6 14 6 15 7 16 7 17 8 18 8 19 9 20 9 21 10 22...
result:
ok has solution
Test #68:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
0 0
output:
1
result:
ok has solution
Test #69:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
0 21
output:
0
result:
ok no solution
Test #70:
score: 0
Accepted
time: 0ms
memory: 1264kb
input:
0 8
output:
0
result:
ok no solution
Test #71:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
56 55
output:
0
result:
ok no solution
Test #72:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
105 102
output:
0
result:
ok no solution
Test #73:
score: 0
Accepted
time: 0ms
memory: 1284kb
input:
146 144
output:
290 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 11 5 12 6 13 6 14 7 15 7 16 8 17 8 18 9 19 9 20 10 21 10 ...
result:
ok has solution
Test #74:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
0 28
output:
0
result:
ok no solution
Test #75:
score: 0
Accepted
time: 0ms
memory: 1284kb
input:
161 35
output:
258 1 2 1 3 1 4 1 5 2 6 2 7 2 8 3 9 3 10 3 11 4 12 4 13 4 14 5 15 5 16 5 17 6 18 6 19 6 20 7 21 7 22...
result:
ok has solution
Extra Test:
score: 0
Extra Test Passed