QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#314966#4195. Looking for WaldoJorbanSWA 0ms3592kbC++171.6kb2024-01-26 15:48:302024-01-26 15:48:30

Judging History

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

  • [2024-01-26 15:48:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3592kb
  • [2024-01-26 15:48:30]
  • 提交

answer

#include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define FastIO cin.tie(nullptr) -> sync_with_stdio(false);
#define Cases int __; cin >> __; for (int _ = 1; _ <= __; _ ++)
#define endl '\n'
#define aa first
#define bb second
const string yes = "Yes";
const string no = "No";

typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
// const int mod = 998244353;
const int N = 2e3 + 2;
const int inf = 0x3f3f3f3f;
int n, m;
char s[N][N];

// string solve() {
// void solve() {
int solve() {
    cin >> n >> m;
    for (int i = 0; i < n; i ++) cin >> s[i];
    vector<vector<int>> e(n);
    int cnt = 0;
    for (int i = 0; i < n; i ++) {
        for (int j = 0; j < m; j ++)
            if (s[i][j] == 'C') e[i].emplace_back(j), cnt ++;
    }
    int res = 0;
    while (cnt) {
        int x = 0, y = 0;
        res ++;
        while (x < n && y < m) {
            // cout << x << ' ' << y << ' ' << cnt << endl;
            while (!e[x].size() && x < n) x ++;
            if (x == n) break;
            for (int i = 0; i < e[x].size(); i ++) {
                if (e[x][i] >= y) {
                    int dx = e[x].size() - i;
                    cnt -= dx;
                    y = e[x].back();
                    while (dx --) e[x].erase(-- e[x].end());
                    break;
                }
            }
            x ++;
        }
    }
    return res;
}

int main() {
    FastIO
    // Cases
    cout << solve() << endl;
    // solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 5
ABCDE
FGHIJ
KLMNO
PQRST
VWXYZ

output:

1

result:

wrong answer 1st lines differ - expected: '25', found: '1'