编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#25544 #1145. ddd 和渡渡鸟 Accepted 100 479 ms 10328 K C++ 11 / 1.2 K 钱91-夏泽 2020-05-13 16:34:43
显示原始代码
#include <iostream>
#include <queue>
#define maxn 2 * 300005
#define INF 10000005
using namespace std;
bool vis[maxn];
int num[maxn];
vector<int> G[maxn];
int a, b;
int ans;
int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); }
queue<pair<int, int> > que;
int main() {
    cin >> a >> b;
    cout.tie(0);
    ans = a + b - gcd(a, b) - 1;
    int i = 0, cnt = 0;
    printf("%d\n", ans);
    for (int i = 0; i < ans; i++) {
        if (vis[i])
            continue;
        que.push(pair<int, int>(i, 0));
        vis[i] = true;
        num[i] = 0;
        while (!que.empty()) {
            int i = que.front().first, lev = que.front().second;
            que.pop();
            num[i] = lev;
            vis[i] = true;
            if (i - a >= 0 && !vis[i - a])
                que.push(pair<int, int>(i - a, lev - 1));
            if (i + a <= ans && !vis[i + a])
                que.push(pair<int, int>(i + a, lev + 1));
            if (i + b <= ans && !vis[i + b])
                que.push(pair<int, int>(i + b, lev - 1));
            if (i - b >= 0 && !vis[i - b])
                que.push(pair<int, int>(i - b, lev + 1));
        }
    }
    for (int i = 1; i <= ans; i++) {
        printf("%d ", num[i] - num[i - 1]);
    }
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:7 ms
内存:7324 KiB

输入文件(1.in

6 8

答案文件(1.out

11
1 -5 1 -5 1 9 1 -5 1 -5 1 

用户输出

11
0 -2 0 -2 0 5 0 -2 0 -2 0 

Special Judge 信息

Accepted | Correct. answer = 11

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:8 ms
内存:7388 KiB

输入文件(2.in

269 152

答案文件(2.out

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
测试点 #3
Accepted
得分:100
用时:10 ms
内存:7432 KiB

输入文件(3.in

4494 6731

答案文件(3.out

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
测试点 #4
Accepted
得分:100
用时:22 ms
内存:8152 KiB

输入文件(4.in

95679 79020

答案文件(4.out

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
测试点 #5
Accepted
得分:100
用时:30 ms
内存:8216 KiB

输入文件(5.in

151274 37556

答案文件(5.out

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
测试点 #6
Accepted
得分:100
用时:24 ms
内存:8412 KiB

输入文件(6.in

17290 193374

答案文件(6.out

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
测试点 #7
Accepted
得分:100
用时:45 ms
内存:9072 KiB

输入文件(7.in

119441 246736

答案文件(7.out

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
测试点 #8
Accepted
得分:100
用时:34 ms
内存:9316 KiB

输入文件(8.in

300000 200000

答案文件(8.out

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
测试点 #9
Accepted
得分:100
用时:49 ms
内存:10328 KiB

输入文件(9.in

300000 299999

答案文件(9.out

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
测试点 #10
Accepted
得分:100
用时:49 ms
内存:10212 KiB

输入文件(10.in

299999 300000

答案文件(10.out

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
测试点 #11
Accepted
得分:100
用时:37 ms
内存:9240 KiB

输入文件(11.in

99443 291115

答案文件(11.out

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
测试点 #12
Accepted
得分:100
用时:29 ms
内存:8804 KiB

输入文件(12.in

243346 49300

答案文件(12.out

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
测试点 #13
Accepted
得分:100
用时:51 ms
内存:9860 KiB

输入文件(13.in

265983 251034

答案文件(13.out

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
测试点 #14
Accepted
得分:100
用时:47 ms
内存:10212 KiB

输入文件(14.in

300000 299998

答案文件(14.out

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
测试点 #15
Accepted
得分:100
用时:9 ms
内存:7300 KiB

输入文件(15.in

1 1

答案文件(15.out

0

用户输出

0

Special Judge 信息

Accepted | Correct. answer = 0

系统信息

Exited with return code 0
测试点 #16
Accepted
得分:100
用时:28 ms
内存:8820 KiB

输入文件(16.in

300000 300000

答案文件(16.out

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