QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#190299#6677. Puzzle: SashiganeJWRuixi#AC ✓1ms3868kbC++202.1kb2023-09-28 16:43:362023-09-28 16:43:37

Judging History

你现在查看的是最新测评结果

  • [2023-09-28 16:43:37]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3868kb
  • [2023-09-28 16:43:36]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
// #define ATC
#define LL long long
#define eb emplace_back
#define writesp(x) write(x), putchar(' ')
#define writeln(x) write(x), putchar('\n')
#define FIO(FILENAME) freopen(FILENAME".in", "r", stdin), freopen(FILENAME".out", "w", stdout)
using namespace std;

#ifdef ATC
#include <atcoder/all>
using namespace atcoder;
#endif

namespace IO {
    char ibuf[(1 << 20) + 1], *iS, *iT;
#if ONLINE_JUDGE
#define gh() (iS == iT ? iT = (iS = ibuf) + fread(ibuf, 1, (1 << 20) + 1, stdin), (iS == iT ? EOF : *iS++) : *iS++)
#else
#define gh() getchar()
#endif
    inline long long read() {
        char ch = gh();
        long long x = 0;
        bool t = 0;
        while (ch < '0' || ch > '9') t |= ch == '-', ch = gh();
        while (ch >= '0' && ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = gh();
        return t ? ~(x - 1) : x;
    }
    template<typename _Tp>
    inline void write(_Tp x) {
        static char stk[64], *top = stk;
        if (x < 0) {
            x = ~(x - 1);
            putchar('-');
        }
        do *top++ = x % 10, x /= 10;
        while (x);
        while (top != stk) putchar((*--top) | 48);
    }
}

using IO::read;
using IO::write;


inline void slv () {
    int n = read(), x = read(), y = read();
    vector<tuple<int, int, int, int>> as;
    for (int i = 1; i < min(x, y); i++) 
        as.eb(i, i, n - i, n - i);
    int b = min(x, y);
    if (x < y) {
        int sx = x + 1, sy = y - 1, d = 1;
        while (sx <= y) {
            as.eb(sx, sy, -d, d);
            ++d, ++sx, --sy;
        }
        x = y;
    } else {
        int sx = x - 1, sy = y + 1, d = 1;
        while (sy <= x) {
            as.eb(sx, sy, d, -d);
            ++d, --sx, ++sy;
        }
        y = x;
    }
    for (int i = x + 1; i <= n; i++) as.eb(i, i, b - i, b - i);
    puts("Yes");
    writeln(as.size());
    for (auto [x, y, z, w] : as) writesp(x), writesp(y), writesp(z), writeln(w);
}

int main() {
    int T = 1;
    while (T--) slv();
    return 0;
}
// I love WHQ!

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3844kb

input:

5 3 4

output:

Yes
4
1 1 4 4
2 2 3 3
4 3 -1 1
5 5 -2 -2

result:

ok Correct. (1 test case)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

1 1 1

output:

Yes
0

result:

ok Correct. (1 test case)

Test #3:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

3 2 3

output:

Yes
2
1 1 2 2
3 2 -1 1

result:

ok Correct. (1 test case)

Test #4:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

10 10 5

output:

Yes
9
1 1 9 9
2 2 8 8
3 3 7 7
4 4 6 6
9 6 1 -1
8 7 2 -2
7 8 3 -3
6 9 4 -4
5 10 5 -5

result:

ok Correct. (1 test case)

Test #5:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

10 5 7

output:

Yes
9
1 1 9 9
2 2 8 8
3 3 7 7
4 4 6 6
6 6 -1 1
7 5 -2 2
8 8 -3 -3
9 9 -4 -4
10 10 -5 -5

result:

ok Correct. (1 test case)

Test #6:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

10 9 2

output:

Yes
9
1 1 9 9
8 3 1 -1
7 4 2 -2
6 5 3 -3
5 6 4 -4
4 7 5 -5
3 8 6 -6
2 9 7 -7
10 10 -8 -8

result:

ok Correct. (1 test case)

Test #7:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

10 6 10

output:

Yes
9
1 1 9 9
2 2 8 8
3 3 7 7
4 4 6 6
5 5 5 5
7 9 -1 1
8 8 -2 2
9 7 -3 3
10 6 -4 4

result:

ok Correct. (1 test case)

Test #8:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

10 8 4

output:

Yes
9
1 1 9 9
2 2 8 8
3 3 7 7
7 5 1 -1
6 6 2 -2
5 7 3 -3
4 8 4 -4
9 9 -5 -5
10 10 -6 -6

result:

ok Correct. (1 test case)

Test #9:

score: 0
Accepted
time: 1ms
memory: 3868kb

input:

999 396 693

output:

Yes
998
1 1 998 998
2 2 997 997
3 3 996 996
4 4 995 995
5 5 994 994
6 6 993 993
7 7 992 992
8 8 991 991
9 9 990 990
10 10 989 989
11 11 988 988
12 12 987 987
13 13 986 986
14 14 985 985
15 15 984 984
16 16 983 983
17 17 982 982
18 18 981 981
19 19 980 980
20 20 979 979
21 21 978 978
22 22 977 977
23...

result:

ok Correct. (1 test case)

Test #10:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

999 963 827

output:

Yes
998
1 1 998 998
2 2 997 997
3 3 996 996
4 4 995 995
5 5 994 994
6 6 993 993
7 7 992 992
8 8 991 991
9 9 990 990
10 10 989 989
11 11 988 988
12 12 987 987
13 13 986 986
14 14 985 985
15 15 984 984
16 16 983 983
17 17 982 982
18 18 981 981
19 19 980 980
20 20 979 979
21 21 978 978
22 22 977 977
23...

result:

ok Correct. (1 test case)

Test #11:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

999 871 185

output:

Yes
998
1 1 998 998
2 2 997 997
3 3 996 996
4 4 995 995
5 5 994 994
6 6 993 993
7 7 992 992
8 8 991 991
9 9 990 990
10 10 989 989
11 11 988 988
12 12 987 987
13 13 986 986
14 14 985 985
15 15 984 984
16 16 983 983
17 17 982 982
18 18 981 981
19 19 980 980
20 20 979 979
21 21 978 978
22 22 977 977
23...

result:

ok Correct. (1 test case)

Test #12:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

999 787 812

output:

Yes
998
1 1 998 998
2 2 997 997
3 3 996 996
4 4 995 995
5 5 994 994
6 6 993 993
7 7 992 992
8 8 991 991
9 9 990 990
10 10 989 989
11 11 988 988
12 12 987 987
13 13 986 986
14 14 985 985
15 15 984 984
16 16 983 983
17 17 982 982
18 18 981 981
19 19 980 980
20 20 979 979
21 21 978 978
22 22 977 977
23...

result:

ok Correct. (1 test case)

Test #13:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

999 396 199

output:

Yes
998
1 1 998 998
2 2 997 997
3 3 996 996
4 4 995 995
5 5 994 994
6 6 993 993
7 7 992 992
8 8 991 991
9 9 990 990
10 10 989 989
11 11 988 988
12 12 987 987
13 13 986 986
14 14 985 985
15 15 984 984
16 16 983 983
17 17 982 982
18 18 981 981
19 19 980 980
20 20 979 979
21 21 978 978
22 22 977 977
23...

result:

ok Correct. (1 test case)

Test #14:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

999 1 1

output:

Yes
998
2 2 -1 -1
3 3 -2 -2
4 4 -3 -3
5 5 -4 -4
6 6 -5 -5
7 7 -6 -6
8 8 -7 -7
9 9 -8 -8
10 10 -9 -9
11 11 -10 -10
12 12 -11 -11
13 13 -12 -12
14 14 -13 -13
15 15 -14 -14
16 16 -15 -15
17 17 -16 -16
18 18 -17 -17
19 19 -18 -18
20 20 -19 -19
21 21 -20 -20
22 22 -21 -21
23 23 -22 -22
24 24 -23 -23
25 2...

result:

ok Correct. (1 test case)

Test #15:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

999 163 1

output:

Yes
998
162 2 1 -1
161 3 2 -2
160 4 3 -3
159 5 4 -4
158 6 5 -5
157 7 6 -6
156 8 7 -7
155 9 8 -8
154 10 9 -9
153 11 10 -10
152 12 11 -11
151 13 12 -12
150 14 13 -13
149 15 14 -14
148 16 15 -15
147 17 16 -16
146 18 17 -17
145 19 18 -18
144 20 19 -19
143 21 20 -20
142 22 21 -21
141 23 22 -22
140 24 23 ...

result:

ok Correct. (1 test case)

Test #16:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

999 999 1

output:

Yes
998
998 2 1 -1
997 3 2 -2
996 4 3 -3
995 5 4 -4
994 6 5 -5
993 7 6 -6
992 8 7 -7
991 9 8 -8
990 10 9 -9
989 11 10 -10
988 12 11 -11
987 13 12 -12
986 14 13 -13
985 15 14 -14
984 16 15 -15
983 17 16 -16
982 18 17 -17
981 19 18 -18
980 20 19 -19
979 21 20 -20
978 22 21 -21
977 23 22 -22
976 24 23 ...

result:

ok Correct. (1 test case)

Test #17:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

999 1 969

output:

Yes
998
2 968 -1 1
3 967 -2 2
4 966 -3 3
5 965 -4 4
6 964 -5 5
7 963 -6 6
8 962 -7 7
9 961 -8 8
10 960 -9 9
11 959 -10 10
12 958 -11 11
13 957 -12 12
14 956 -13 13
15 955 -14 14
16 954 -15 15
17 953 -16 16
18 952 -17 17
19 951 -18 18
20 950 -19 19
21 949 -20 20
22 948 -21 21
23 947 -22 22
24 946 -23...

result:

ok Correct. (1 test case)

Test #18:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

999 999 780

output:

Yes
998
1 1 998 998
2 2 997 997
3 3 996 996
4 4 995 995
5 5 994 994
6 6 993 993
7 7 992 992
8 8 991 991
9 9 990 990
10 10 989 989
11 11 988 988
12 12 987 987
13 13 986 986
14 14 985 985
15 15 984 984
16 16 983 983
17 17 982 982
18 18 981 981
19 19 980 980
20 20 979 979
21 21 978 978
22 22 977 977
23...

result:

ok Correct. (1 test case)

Test #19:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

999 1 999

output:

Yes
998
2 998 -1 1
3 997 -2 2
4 996 -3 3
5 995 -4 4
6 994 -5 5
7 993 -6 6
8 992 -7 7
9 991 -8 8
10 990 -9 9
11 989 -10 10
12 988 -11 11
13 987 -12 12
14 986 -13 13
15 985 -14 14
16 984 -15 15
17 983 -16 16
18 982 -17 17
19 981 -18 18
20 980 -19 19
21 979 -20 20
22 978 -21 21
23 977 -22 22
24 976 -23...

result:

ok Correct. (1 test case)

Test #20:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

999 686 999

output:

Yes
998
1 1 998 998
2 2 997 997
3 3 996 996
4 4 995 995
5 5 994 994
6 6 993 993
7 7 992 992
8 8 991 991
9 9 990 990
10 10 989 989
11 11 988 988
12 12 987 987
13 13 986 986
14 14 985 985
15 15 984 984
16 16 983 983
17 17 982 982
18 18 981 981
19 19 980 980
20 20 979 979
21 21 978 978
22 22 977 977
23...

result:

ok Correct. (1 test case)

Test #21:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

999 999 999

output:

Yes
998
1 1 998 998
2 2 997 997
3 3 996 996
4 4 995 995
5 5 994 994
6 6 993 993
7 7 992 992
8 8 991 991
9 9 990 990
10 10 989 989
11 11 988 988
12 12 987 987
13 13 986 986
14 14 985 985
15 15 984 984
16 16 983 983
17 17 982 982
18 18 981 981
19 19 980 980
20 20 979 979
21 21 978 978
22 22 977 977
23...

result:

ok Correct. (1 test case)

Test #22:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

1000 757 728

output:

Yes
999
1 1 999 999
2 2 998 998
3 3 997 997
4 4 996 996
5 5 995 995
6 6 994 994
7 7 993 993
8 8 992 992
9 9 991 991
10 10 990 990
11 11 989 989
12 12 988 988
13 13 987 987
14 14 986 986
15 15 985 985
16 16 984 984
17 17 983 983
18 18 982 982
19 19 981 981
20 20 980 980
21 21 979 979
22 22 978 978
23...

result:

ok Correct. (1 test case)

Test #23:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

1000 132 993

output:

Yes
999
1 1 999 999
2 2 998 998
3 3 997 997
4 4 996 996
5 5 995 995
6 6 994 994
7 7 993 993
8 8 992 992
9 9 991 991
10 10 990 990
11 11 989 989
12 12 988 988
13 13 987 987
14 14 986 986
15 15 985 985
16 16 984 984
17 17 983 983
18 18 982 982
19 19 981 981
20 20 980 980
21 21 979 979
22 22 978 978
23...

result:

ok Correct. (1 test case)

Test #24:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

1000 703 499

output:

Yes
999
1 1 999 999
2 2 998 998
3 3 997 997
4 4 996 996
5 5 995 995
6 6 994 994
7 7 993 993
8 8 992 992
9 9 991 991
10 10 990 990
11 11 989 989
12 12 988 988
13 13 987 987
14 14 986 986
15 15 985 985
16 16 984 984
17 17 983 983
18 18 982 982
19 19 981 981
20 20 980 980
21 21 979 979
22 22 978 978
23...

result:

ok Correct. (1 test case)

Test #25:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

1000 910 298

output:

Yes
999
1 1 999 999
2 2 998 998
3 3 997 997
4 4 996 996
5 5 995 995
6 6 994 994
7 7 993 993
8 8 992 992
9 9 991 991
10 10 990 990
11 11 989 989
12 12 988 988
13 13 987 987
14 14 986 986
15 15 985 985
16 16 984 984
17 17 983 983
18 18 982 982
19 19 981 981
20 20 980 980
21 21 979 979
22 22 978 978
23...

result:

ok Correct. (1 test case)

Test #26:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

1000 171 322

output:

Yes
999
1 1 999 999
2 2 998 998
3 3 997 997
4 4 996 996
5 5 995 995
6 6 994 994
7 7 993 993
8 8 992 992
9 9 991 991
10 10 990 990
11 11 989 989
12 12 988 988
13 13 987 987
14 14 986 986
15 15 985 985
16 16 984 984
17 17 983 983
18 18 982 982
19 19 981 981
20 20 980 980
21 21 979 979
22 22 978 978
23...

result:

ok Correct. (1 test case)

Test #27:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

1000 1 1

output:

Yes
999
2 2 -1 -1
3 3 -2 -2
4 4 -3 -3
5 5 -4 -4
6 6 -5 -5
7 7 -6 -6
8 8 -7 -7
9 9 -8 -8
10 10 -9 -9
11 11 -10 -10
12 12 -11 -11
13 13 -12 -12
14 14 -13 -13
15 15 -14 -14
16 16 -15 -15
17 17 -16 -16
18 18 -17 -17
19 19 -18 -18
20 20 -19 -19
21 21 -20 -20
22 22 -21 -21
23 23 -22 -22
24 24 -23 -23
25 2...

result:

ok Correct. (1 test case)

Test #28:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

1000 480 1

output:

Yes
999
479 2 1 -1
478 3 2 -2
477 4 3 -3
476 5 4 -4
475 6 5 -5
474 7 6 -6
473 8 7 -7
472 9 8 -8
471 10 9 -9
470 11 10 -10
469 12 11 -11
468 13 12 -12
467 14 13 -13
466 15 14 -14
465 16 15 -15
464 17 16 -16
463 18 17 -17
462 19 18 -18
461 20 19 -19
460 21 20 -20
459 22 21 -21
458 23 22 -22
457 24 23 ...

result:

ok Correct. (1 test case)

Test #29:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

1000 1000 1

output:

Yes
999
999 2 1 -1
998 3 2 -2
997 4 3 -3
996 5 4 -4
995 6 5 -5
994 7 6 -6
993 8 7 -7
992 9 8 -8
991 10 9 -9
990 11 10 -10
989 12 11 -11
988 13 12 -12
987 14 13 -13
986 15 14 -14
985 16 15 -15
984 17 16 -16
983 18 17 -17
982 19 18 -18
981 20 19 -19
980 21 20 -20
979 22 21 -21
978 23 22 -22
977 24 23 ...

result:

ok Correct. (1 test case)

Test #30:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

1000 1 339

output:

Yes
999
2 338 -1 1
3 337 -2 2
4 336 -3 3
5 335 -4 4
6 334 -5 5
7 333 -6 6
8 332 -7 7
9 331 -8 8
10 330 -9 9
11 329 -10 10
12 328 -11 11
13 327 -12 12
14 326 -13 13
15 325 -14 14
16 324 -15 15
17 323 -16 16
18 322 -17 17
19 321 -18 18
20 320 -19 19
21 319 -20 20
22 318 -21 21
23 317 -22 22
24 316 -23...

result:

ok Correct. (1 test case)

Test #31:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

1000 1000 161

output:

Yes
999
1 1 999 999
2 2 998 998
3 3 997 997
4 4 996 996
5 5 995 995
6 6 994 994
7 7 993 993
8 8 992 992
9 9 991 991
10 10 990 990
11 11 989 989
12 12 988 988
13 13 987 987
14 14 986 986
15 15 985 985
16 16 984 984
17 17 983 983
18 18 982 982
19 19 981 981
20 20 980 980
21 21 979 979
22 22 978 978
23...

result:

ok Correct. (1 test case)

Test #32:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

1000 1 1000

output:

Yes
999
2 999 -1 1
3 998 -2 2
4 997 -3 3
5 996 -4 4
6 995 -5 5
7 994 -6 6
8 993 -7 7
9 992 -8 8
10 991 -9 9
11 990 -10 10
12 989 -11 11
13 988 -12 12
14 987 -13 13
15 986 -14 14
16 985 -15 15
17 984 -16 16
18 983 -17 17
19 982 -18 18
20 981 -19 19
21 980 -20 20
22 979 -21 21
23 978 -22 22
24 977 -23...

result:

ok Correct. (1 test case)

Test #33:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

1000 759 1000

output:

Yes
999
1 1 999 999
2 2 998 998
3 3 997 997
4 4 996 996
5 5 995 995
6 6 994 994
7 7 993 993
8 8 992 992
9 9 991 991
10 10 990 990
11 11 989 989
12 12 988 988
13 13 987 987
14 14 986 986
15 15 985 985
16 16 984 984
17 17 983 983
18 18 982 982
19 19 981 981
20 20 980 980
21 21 979 979
22 22 978 978
23...

result:

ok Correct. (1 test case)

Test #34:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

1000 1000 1000

output:

Yes
999
1 1 999 999
2 2 998 998
3 3 997 997
4 4 996 996
5 5 995 995
6 6 994 994
7 7 993 993
8 8 992 992
9 9 991 991
10 10 990 990
11 11 989 989
12 12 988 988
13 13 987 987
14 14 986 986
15 15 985 985
16 16 984 984
17 17 983 983
18 18 982 982
19 19 981 981
20 20 980 980
21 21 979 979
22 22 978 978
23...

result:

ok Correct. (1 test case)

Test #35:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

2 1 1

output:

Yes
1
2 2 -1 -1

result:

ok Correct. (1 test case)

Test #36:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

2 1 2

output:

Yes
1
2 1 -1 1

result:

ok Correct. (1 test case)

Test #37:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

2 2 1

output:

Yes
1
1 2 1 -1

result:

ok Correct. (1 test case)

Test #38:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

2 2 2

output:

Yes
1
1 1 1 1

result:

ok Correct. (1 test case)

Test #39:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

810 114 514

output:

Yes
809
1 1 809 809
2 2 808 808
3 3 807 807
4 4 806 806
5 5 805 805
6 6 804 804
7 7 803 803
8 8 802 802
9 9 801 801
10 10 800 800
11 11 799 799
12 12 798 798
13 13 797 797
14 14 796 796
15 15 795 795
16 16 794 794
17 17 793 793
18 18 792 792
19 19 791 791
20 20 790 790
21 21 789 789
22 22 788 788
23...

result:

ok Correct. (1 test case)

Test #40:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

810 514 114

output:

Yes
809
1 1 809 809
2 2 808 808
3 3 807 807
4 4 806 806
5 5 805 805
6 6 804 804
7 7 803 803
8 8 802 802
9 9 801 801
10 10 800 800
11 11 799 799
12 12 798 798
13 13 797 797
14 14 796 796
15 15 795 795
16 16 794 794
17 17 793 793
18 18 792 792
19 19 791 791
20 20 790 790
21 21 789 789
22 22 788 788
23...

result:

ok Correct. (1 test case)