QOJ.ac

QOJ

ID提交记录ID题目HackerOwner结果提交时间测评时间
#1556#822864#9841. Elegant TetrisFurinaHateCommaFurinaHateCommaFailed.2025-02-10 08:13:552025-02-10 08:13:55

詳細信息

Extra Test:

Invalid Input

input:

nailong

output:


result:

FAIL Expected integer, but "nailong" found (stdin, line 1)

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#822864#9841. Elegant TetrisFurinaHateComma#AC ✓2ms3788kbC++141.6kb2024-12-20 17:05:352024-12-20 17:05:37

answer

#include <bits/stdc++.h>
using namespace std;

void solve() {
    int w, n, m = 0;
    cin >> w >> n;
    bool flag = 0;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < w; j++) {
            if (s[j] == '#') {
                m = j;
                flag = 1;
                break;
            }
        }
        if (flag) break;
    }
    if (w == 4) {
        cout << 1 << endl;
        cout << "I 1 1" << endl;
        return;
    }
    cout << w << endl;
    if (w & 1) {
        int center = min(w - 2, (m | 1));
        cout << "T 2 " << center << endl;
        for (int i = center - 2; i >= 1; i -= 2)
            cout << "S 0 " << i << endl;
        for (int i = center + 2; i + 2 <= w; i += 2)
            cout << "Z 0 " << i << endl;
        cout << "T 3 1" << endl;
        for (int i = 2; i + 2 < w; i += 2)
            cout << "Z 0 " << i << endl;
        cout << "L 2 " << w - 1 << endl;
    } else {
        int center = min(w - 3, (m | 1));
        cout << "I 1 " << center << endl;
        cout << "O 0 " << center + 1 << endl;
        for (int i = center - 2; i >= 1; i -= 2) {
            cout << "S 0 " << i << endl;
            cout << "S 0 " << i + 1 << endl;
        }
        for (int i = center + 3; i + 2 <= w; i += 2) {
            cout << "Z 0 " << i << endl;
            cout << "Z 0 " << i - 1 << endl;
        }
        cout << "J 2 1" << endl;
        cout << "L 2 " << w - 1 << endl;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    while (_--) solve();
    return 0;
}