Submission #573845

# Submission time Handle Problem Language Result Execution time Memory
573845 2022-06-07T10:17:07 Z colossal_pepe Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 4604 KB
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int n, q;
set<string> dict;
vector<string> all, now(3);
string t;

char crossChar(char c1, char c2) {
    if (c1 == c2) return c1;
    if (c1 != 'J' and c2 != 'J') return 'J';
    else if (c1 != 'O' and c2 != 'O') return 'O';
    else return 'I';
}

string crossStr(string s1, string s2) {
    string ret;
    for (int i = 0; i < s1.size(); i++) {
        ret += crossChar(s1[i], s2[i]);
    }
    return ret;
}

void generate() {
    while (not now.empty()) {
        string s = now.back();
        now.pop_back();
        if (dict.find(s) != dict.end()) continue;
        dict.insert(s);
        all.push_back(s);
        for (string t : all) {
            now.push_back(crossStr(s, t));
        }
    }
}

bool check() {
    for (string s : all) {
        if (t == s) return 1;
    }
    return 0;
}

int main() {
    cin >> n >> now[0] >> now[1] >> now[2];
    generate();
    cin >> q >> t;
    cout << (check() ? "Yes" : "No") << '\n';
    while (q--) {
        int l, r;
        char c;
        cin >> l >> r >> c;
        for (int i = l - 1; i <= r - 1; i++) {
            t[i] = c;
        }
        cout << (check() ? "Yes" : "No") << '\n';
    }
    return 0;
}

Compilation message

Main.cpp: In function 'std::string crossStr(std::string, std::string)':
Main.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int i = 0; i < s1.size(); i++) {
      |                     ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 312 ms 2252 KB Output is correct
2 Correct 356 ms 2536 KB Output is correct
3 Correct 380 ms 2240 KB Output is correct
4 Correct 330 ms 2332 KB Output is correct
5 Correct 337 ms 2260 KB Output is correct
6 Correct 361 ms 2232 KB Output is correct
7 Correct 341 ms 2340 KB Output is correct
8 Correct 344 ms 2352 KB Output is correct
9 Correct 368 ms 2356 KB Output is correct
10 Correct 352 ms 2396 KB Output is correct
11 Correct 358 ms 2376 KB Output is correct
12 Correct 377 ms 2380 KB Output is correct
13 Correct 344 ms 2400 KB Output is correct
14 Correct 369 ms 2412 KB Output is correct
15 Correct 342 ms 2512 KB Output is correct
16 Correct 355 ms 2480 KB Output is correct
17 Correct 343 ms 2404 KB Output is correct
18 Correct 395 ms 2336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 312 ms 2252 KB Output is correct
2 Correct 356 ms 2536 KB Output is correct
3 Correct 380 ms 2240 KB Output is correct
4 Correct 330 ms 2332 KB Output is correct
5 Correct 337 ms 2260 KB Output is correct
6 Correct 361 ms 2232 KB Output is correct
7 Correct 341 ms 2340 KB Output is correct
8 Correct 344 ms 2352 KB Output is correct
9 Correct 368 ms 2356 KB Output is correct
10 Correct 352 ms 2396 KB Output is correct
11 Correct 358 ms 2376 KB Output is correct
12 Correct 377 ms 2380 KB Output is correct
13 Correct 344 ms 2400 KB Output is correct
14 Correct 369 ms 2412 KB Output is correct
15 Correct 342 ms 2512 KB Output is correct
16 Correct 355 ms 2480 KB Output is correct
17 Correct 343 ms 2404 KB Output is correct
18 Correct 395 ms 2336 KB Output is correct
19 Execution timed out 7035 ms 4604 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 312 ms 2252 KB Output is correct
2 Correct 356 ms 2536 KB Output is correct
3 Correct 380 ms 2240 KB Output is correct
4 Correct 330 ms 2332 KB Output is correct
5 Correct 337 ms 2260 KB Output is correct
6 Correct 361 ms 2232 KB Output is correct
7 Correct 341 ms 2340 KB Output is correct
8 Correct 344 ms 2352 KB Output is correct
9 Correct 368 ms 2356 KB Output is correct
10 Correct 352 ms 2396 KB Output is correct
11 Correct 358 ms 2376 KB Output is correct
12 Correct 377 ms 2380 KB Output is correct
13 Correct 344 ms 2400 KB Output is correct
14 Correct 369 ms 2412 KB Output is correct
15 Correct 342 ms 2512 KB Output is correct
16 Correct 355 ms 2480 KB Output is correct
17 Correct 343 ms 2404 KB Output is correct
18 Correct 395 ms 2336 KB Output is correct
19 Correct 384 ms 2316 KB Output is correct
20 Correct 487 ms 2252 KB Output is correct
21 Correct 361 ms 2372 KB Output is correct
22 Correct 348 ms 2100 KB Output is correct
23 Correct 398 ms 2400 KB Output is correct
24 Correct 345 ms 2248 KB Output is correct
25 Correct 372 ms 2380 KB Output is correct
26 Correct 358 ms 2312 KB Output is correct
27 Correct 357 ms 2420 KB Output is correct
28 Correct 348 ms 2092 KB Output is correct
29 Correct 357 ms 2380 KB Output is correct
30 Correct 336 ms 2156 KB Output is correct
31 Correct 407 ms 2416 KB Output is correct
32 Correct 418 ms 2392 KB Output is correct
33 Correct 412 ms 2436 KB Output is correct
34 Correct 408 ms 2312 KB Output is correct
35 Correct 399 ms 2352 KB Output is correct
36 Correct 392 ms 2304 KB Output is correct
37 Correct 414 ms 2380 KB Output is correct
38 Correct 405 ms 2380 KB Output is correct
39 Correct 406 ms 2364 KB Output is correct
40 Correct 395 ms 2408 KB Output is correct
41 Correct 411 ms 2380 KB Output is correct
42 Correct 397 ms 2516 KB Output is correct
43 Correct 387 ms 2404 KB Output is correct
44 Correct 471 ms 2332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 312 ms 2252 KB Output is correct
2 Correct 356 ms 2536 KB Output is correct
3 Correct 380 ms 2240 KB Output is correct
4 Correct 330 ms 2332 KB Output is correct
5 Correct 337 ms 2260 KB Output is correct
6 Correct 361 ms 2232 KB Output is correct
7 Correct 341 ms 2340 KB Output is correct
8 Correct 344 ms 2352 KB Output is correct
9 Correct 368 ms 2356 KB Output is correct
10 Correct 352 ms 2396 KB Output is correct
11 Correct 358 ms 2376 KB Output is correct
12 Correct 377 ms 2380 KB Output is correct
13 Correct 344 ms 2400 KB Output is correct
14 Correct 369 ms 2412 KB Output is correct
15 Correct 342 ms 2512 KB Output is correct
16 Correct 355 ms 2480 KB Output is correct
17 Correct 343 ms 2404 KB Output is correct
18 Correct 395 ms 2336 KB Output is correct
19 Execution timed out 7035 ms 4604 KB Time limit exceeded
20 Halted 0 ms 0 KB -