Submission #931559

# Submission time Handle Problem Language Result Execution time Memory
931559 2024-02-22T04:14:31 Z Pring Modern Machine (JOI23_ho_t5) C++14
15 / 100
72 ms 836 KB
#include <bits/stdc++.h>
using namespace std;

#ifdef MIKU
#define debug(x...) cout << "[" << #x << "] : ", dout(x)
void dout() { cout << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif

#define int long long
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;

const int MXN = 7005;
int n, m, q, a[MXN];
string s;

void DO(int sr) {
    debug(sr);
    s[sr] = 'R';
    vector<int> B, R;
    FOR(i, sr + 1, n) if (s[i] == 'B') B.push_back(i);
    for (int i = sr - 1; i >= 0; i--) if (s[i] == 'R') R.push_back(i);
    if (B.size() > R.size()) {
        FOR(i, 0, B[R.size()] + 1) s[i] = 'R';
    } else {
        if (B.empty()) FOR(i, sr, n) s[i] = 'B';
        else FOR(i, R[B.size() - 1], n) s[i] = 'B';
    }
    debug(s);
}

void miku() {
    int l, r;
    cin >> n >> m >> s;
    if (n > MXN || m > MXN) return;
    FOR(i, 1, m + 1) cin >> a[i];
    cin >> q;
    if (q > 1) return;
    cin >> l >> r;
    FOR(i, l, r + 1) DO(a[i] - 1);
    int ans = 0;
    for (auto &i : s) ans += (i == 'R');
    cout << ans << '\n';
}

int32_t main() {
    cin.tie(0) -> sync_with_stdio(false);
    cin.exceptions(iostream::failbit);
    miku();
    return 0;
}

Compilation message

Main.cpp: In function 'void DO(long long int)':
Main.cpp:10:20: warning: statement has no effect [-Wunused-value]
   10 | #define debug(...) 39
      |                    ^~
Main.cpp:25:5: note: in expansion of macro 'debug'
   25 |     debug(sr);
      |     ^~~~~
Main.cpp:10:20: warning: statement has no effect [-Wunused-value]
   10 | #define debug(...) 39
      |                    ^~
Main.cpp:36:5: note: in expansion of macro 'debug'
   36 |     debug(s);
      |     ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 42 ms 604 KB Output is correct
11 Correct 20 ms 604 KB Output is correct
12 Correct 46 ms 836 KB Output is correct
13 Correct 72 ms 604 KB Output is correct
14 Correct 57 ms 648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 42 ms 604 KB Output is correct
11 Correct 20 ms 604 KB Output is correct
12 Correct 46 ms 836 KB Output is correct
13 Correct 72 ms 604 KB Output is correct
14 Correct 57 ms 648 KB Output is correct
15 Incorrect 1 ms 348 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 42 ms 604 KB Output is correct
11 Correct 20 ms 604 KB Output is correct
12 Correct 46 ms 836 KB Output is correct
13 Correct 72 ms 604 KB Output is correct
14 Correct 57 ms 648 KB Output is correct
15 Incorrect 1 ms 348 KB Output isn't correct
16 Halted 0 ms 0 KB -