QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#830705#9841. Elegant TetriszsddsWA 0ms3900kbC++141.2kb2024-12-24 21:50:462024-12-24 21:50:47

Judging History

This is the latest submission verdict.

  • [2024-12-24 21:50:47]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3900kb
  • [2024-12-24 21:50:46]
  • Submitted

answer

#include <bits/stdc++.h>
const int MAXN = 1e3+9, H = 29;

int w, n;
char mp[H][MAXN];
std::vector<std::tuple<char, int, int>> ans;
int main(){
    scanf("%d%d", &w, &n);
    bool ex = false;
    int p = 1;
    for (int i=n; i>=1; --i){
        scanf("%s", mp[i]+1);
        for (int j=1; j<=w; ++j){
            if (!ex && mp[i][j]=='#') ex = true, p = j;
        }
    }
    if (w <= 4){ puts("I 1 1"); return 0; }


    p = std::max(1, p - 3);
    ans.push_back({'I', 1, p});
    ans.push_back({'O', 0, p+1});

    for (int i=p+3; i+2<=w; i+=2) ans.push_back({'Z', 0, i});
    if (p+3 < w) ans.push_back({'T', 1, w-1});
    for (int i=w-((w-p)&1); i-2>=p+4; i-=2) ans.push_back({'S', 0, i-2});
    if (p+3 >= w) ans.push_back({'L', 2, p+2});
    else ans.push_back({'T', 0, p+2});

    for (int i=p; i-2>=1; i-=2) ans.push_back({'S', 0, i-2});
    if (p > 1) ans.push_back({'T', 3, 1});
    for (int i=1+(p&1); i+2<=p-1; i+=2) ans.push_back({'Z', 0, i});
    if (p == 1) ans.push_back({'J', 2, p});
    else ans.push_back({'T', 0, p-1});

    printf("%d\n", int(ans.size()));
    for (auto [ch, r, p] : ans) printf("%c %d %d\n", ch, r, p);

    return 0;
}

/*
5 4
#....
###..
####.
#..#.

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 2
#....
.#..#

output:

5
I 1 1
O 0 2
T 1 4
T 0 3
J 2 1

result:

ok 5 actions

Test #2:

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

input:

5 4
#....
###..
####.
#..#.

output:

5
I 1 1
O 0 2
T 1 4
T 0 3
J 2 1

result:

ok 5 actions

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3768kb

input:

4 0

output:

I 1 1

result:

wrong output format Expected integer, but "I" found