QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#643237#8776. Not Another Constructive!Sy03WA 0ms3556kbC++202.7kb2024-10-15 20:01:432024-10-15 20:01:45

Judging History

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

  • [2024-10-15 20:01:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3556kb
  • [2024-10-15 20:01:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using ull = unsigned long long;
using ll = long long;
#define endl '\n'
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int maxn = 2e5 + 10;
const int mod = 1000000007;
#define inl inline
#define fr(i, a, b) for (int i = a; i <= b; i++)
#define ford(i, a, b) for (int i = a; i >= b; i--)
#define forall(i, a) for (auto &i : a)

/**
   ____         ___ _____
  / ___| _   _ / _ \___ /
  \___ \| | | | | | ||_ \
   ___) | |_| | |_| |__) |
  |____/ \__, |\___/____/
         |___/
*/
istream &operator>>(istream &in, vector<int> &v)
{
    for (auto &i : v)
        in >> i;
    return in;
}
ostream &operator<<(ostream &out, vector<int> &v)
{
    for (auto &i : v)
        out << i << " ";
    return out;
}
bool _output = 0;

vector<string> ans;
vector<string> s(4);
void swap_a()
{
    swap(s[1][0], s[2][9]);
    ans.push_back("c2");
    ans.push_back("g2");
    ans.push_back("c1");
}

void swap_b()
{
    char &c1 = s[2][0], &c2 = s[3][9];
    ans.push_back("c2");
    ans.push_back("r2");
    ans.push_back("c1");
    swap(c1, c2);
}
void swap_c()
{
    char &c1 = s[1][9], &c2 = s[3][0];
    ans.push_back("c2");
    ans.push_back("o2");
    ans.push_back("c1");
}
void rotate_a()
{
    ans.push_back("o2");
    auto &t = s[1];
    s[1] = t.substr(1) + t[0];
}
void rotate_b()
{
    ans.push_back("g2");
    auto &t = s[2];
    s[2] = t.substr(1) + t[0];
}
void rotate_c()
{
    ans.push_back("r2");
    auto &t = s[3];
    s[3] = t.substr(1) + t[0];
}
void solve()
{
    fr(i, 1, 3)
            cin >>
        s[i];

    int cnt = 0;
    while (cnt < 10)
    {
        while (cnt < 10 && s[3][9] != 'o')
        {
            rotate_c();
            cnt++;
        }
        while (s[2][0] == 'o')
        {
            rotate_b();
        }
        swap_b();
    }
    cnt = 0;
    while (cnt < 10)
    {
        while (cnt < 10 && s[2][9] != 'o')
        {
            rotate_b();
            cnt++;
        }
        while (s[1][0] == 'o')
        {
            rotate_a();
            // cnt++ ;
        }
        swap_a();
    }

    cnt = 0;
    while (cnt < 10)
    {
        while (cnt < 10 && s[3][9] != 'g')
        {
            rotate_c();
            cnt++;
        }
        while (s[2][0] == 'g')
        {
            rotate_b();
            // cnt++ ;
        }
        swap_b();
    }
    cout << ans.size() << endl;
    for (auto i : ans)
    {
        cout << i << endl;
    }
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    if (_output)
        cin >> _;
    while (_--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3556kb

input:

22 2
N??A??????C???????????

output:

39
r2
r2
r2
r2
r2
r2
r2
r2
r2
r2
c2
r2
c1
g2
g2
g2
g2
g2
g2
g2
g2
g2
g2
c2
g2
c1
r2
r2
r2
r2
r2
r2
r2
r2
r2
r2
c2
r2
c1

result:

wrong answer illegal char