用户输出
11
0 -2 0 -2 0 5 0 -2 0 -2 0
Special Judge 信息
Accepted | Correct. answer = 11
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#25588 | #1145. ddd 和渡渡鸟 | Accepted | 100 | 1173 ms | 82660 K | C++ 17 / 1.3 K | q3540555 | 2020-05-27 15:43:34 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
const int rge = 2e6;
ll arr[rge], psu[rge], idg[rge];
set<int> odg[rge];
vector<int> rk;
void pzero(int n) {
for (int i = 0; i < n; ++i) printf("0 ");
}
void solve() {
ll a, b;
cin >> a >> b;
ll gab = gcd(a, b);
ll n = (a /= gab) + (b /= gab) - 2;
ll ans = (n + 1) * (gab - 1) + n;
cout << ans << endl;
if (ans > 1e6)
return;
for (int i = 0; i <= n - a; ++i) ++idg[i + a], odg[i].insert(i + a);
for (int i = 0; i <= n - b; ++i) ++idg[i], odg[i + b].insert(i);
queue<int> stp;
for (int i = 0; i <= n; ++i)
if (!idg[i])
stp.push(i);
while (!stp.empty()) {
ll fnt = stp.front();
stp.pop();
rk.push_back(fnt);
for (int x : odg[fnt]) {
--idg[x];
if (idg[x] == 0)
stp.push(x);
}
}
for (int i = 0; i < rk.size(); ++i) psu[rk[i]] = i;
for (int i = 1; i <= n; ++i) arr[i] = psu[i] - psu[i - 1];
pzero(gab - 1);
for (int i = 1; i <= n; ++i) printf("%lld ", arr[i]), pzero(gab - 1);
return;
}
int main() {
solve();
return 0;
}
用户输出
11
0 -2 0 -2 0 5 0 -2 0 -2 0
Special Judge 信息
Accepted | Correct. answer = 11
系统信息
Exited with return code 0
419
36 36 36 36 36 36 36 36 36 36 -385 36 36 36 36 36 36 36 36 36 36 36 -385 36 36 36 36 36 36 36 36
<1231 bytes omitted>
用户输出
419
36 36 36 36 36 36 36 36 36 36 -385 36 36 36 36 36 36 36 36 36 36 36 -385 36 36 36 36 36 36 36 36 36 36 36 -385 36 36 36 36 3
<1203 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 419
系统信息
Exited with return code 0
11223
3929 -7296 3929 3929 -7296 3929 3929 -7296 3929 3929 -7296 3929 3929 -7296 3929 3929 -7296 392
<59949 bytes omitted>
用户输出
11223
3929 -7296 3929 3929 -7296 3929 3929 -7296 3929 3929 -7296 3929 3929 -7296 3929 3929 -7296 3929 -7296 3929 3929 -7296 3929
<59921 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 11223
系统信息
Exited with return code 0
174689
1 1 1 1 1 1 1 1 -46349 1 1 1 1 1 1 1 1 -46349 1 1 1 1 1 1 1 1 128350 1 1 1 1 1 1 1 1 -46349 1
<446330 bytes omitted>
用户输出
174689
0 0 0 0 0 0 0 0 -5149 0 0 0 0 0 0 0 0 -5149 0 0 0 0 0 0 0 0 14262 0 0 0 0 0 0 0 0 -5149 0 0 0 0 0 0 0 0 -5149 0 0 0 0 0 0
<426893 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 174689
系统信息
Exited with return code 0
188827
1 -51075 1 -51075 1 137755 1 -51075 1 -51075 1 -51075 1 137755 1 -51075 1 -51075 1 -51075 1 1
<849626 bytes omitted>
用户输出
188827
0 -25537 0 -25537 0 68878 0 -25537 0 -25537 0 -25537 0 68878 0 -25537 0 -25537 0 -25537 0 68878 0 -25537 0 -25537 0 68878
<824062 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 188827
系统信息
Exited with return code 0
210661
1 -33215 1 -33215 1 -33215 1 -33215 1 -33215 1 177449 1 -33215 1 -33215 1 -33215 1 -33215 1 -
<947879 bytes omitted>
用户输出
210661
0 -16607 0 -16607 0 -16607 0 -16607 0 -16607 0 88725 0 -16607 0 -16607 0 -16607 0 -16607 0 -16607 0 88725 0 -16607 0 -166
<931245 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 210661
系统信息
Exited with return code 0
366169
1 1 1 1 1 1 -102157 1 1 1 1 1 1 -102157 1 1 1 1 1 1 264020 1 1 1 1 1 1 -102157 1 1 1 1 1 1 -1
<1031507 bytes omitted>
用户输出
366169
0 0 0 0 0 0 -14593 0 0 0 0 0 0 -14593 0 0 0 0 0 0 37718 0 0 0 0 0 0 -14593 0 0 0 0 0 0 -14593 0 0 0 0 0 0 -14593 0 0 0 0
<979170 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 366169
系统信息
Exited with return code 0
399999
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
<799921 bytes omitted>
用户输出
399999
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
<799878 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 399999
系统信息
Exited with return code 0
599997
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
<1199907 bytes omitted>
用户输出
599997
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
<1199879 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 599997
系统信息
Exited with return code 0
599997
-2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2
<1799902 bytes omitted>
用户输出
599997
-2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -
<1799874 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 599997
系统信息
Exited with return code 0
390556
191381 -199177 191381 -199177 191381 -199177 191381 -199177 191381 -199177 191381 -199177 191
<2925179 bytes omitted>
用户输出
390556
191381 -199177 191381 -199177 191381 -199177 191381 -199177 191381 -199177 191381 -199177 191381 -199177 191381 -199177 1
<2925151 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 390556
系统信息
Exited with return code 0
292643
1 -15589 1 -15589 1 -15589 1 -15589 1 -15589 1 -15589 1 -15589 1 -15589 1 -15589 1 -15589 1 -
<1316798 bytes omitted>
用户输出
292643
0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0 -7794 0
<1178242 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 292643
系统信息
Exited with return code 0
517013
1 1 -105107 1 1 -105107 1 1 -105107 1 1 411910 1 1 -105107 1 1 -105107 1 1 -105107 1 1 -10510
<2032921 bytes omitted>
用户输出
517013
0 0 -35035 0 0 -35035 0 0 -35035 0 0 137304 0 0 -35035 0 0 -35035 0 0 -35035 0 0 -35035 0 0 137304 0 0 -35035 0 0 -35035
<1895590 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 517013
系统信息
Exited with return code 0
599995
1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1
<1199903 bytes omitted>
用户输出
599995
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
<1199875 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 599995
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted | Correct. answer = 0
系统信息
Exited with return code 0
299999
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
<599905 bytes omitted>
用户输出
299999
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
<599877 bytes omitted>
Special Judge 信息
Accepted | Correct. answer = 299999
系统信息
Exited with return code 0