답안 #864274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
864274 2023-10-22T09:54:14 Z vjudge1 Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 2432 KB
#include <bits/stdc++.h>

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,unroll-loops")

using namespace std;

#define endl '\n'
#define ll long long
#define all(x) x.begin(), x.end()

string merge(string a, string b) {
    string c = "";
    for (int i = 0; i < a.size(); i++) {
        if (a[i] == b[i]) c += a[i];
        else {
            set<char> f;
            f.insert(a[i]);
            f.insert(b[i]);
            if (!f.count('J')) c += "J";
            if (!f.count('O')) c += "O";
            if (!f.count('I')) c += "I";
        }
    }
    return c;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    string s[3];
    for (int i = 0; i < 3; i++) cin >> s[i];
    set<string> all;
    all.insert(s[0]);
    all.insert(s[1]);
    all.insert(s[2]);
    all.insert(merge(s[0], s[1]));
    all.insert(merge(s[0], s[2]));
    all.insert(merge(s[1], s[2]));
    all.insert(merge(s[0], merge(s[1], s[2])));
    all.insert(merge(s[1], merge(s[0], s[2])));
    all.insert(merge(s[2], merge(s[0], s[1])));
    int q;
    cin >> q;
    string t;
    cin >> t;
    cout << (all.count(t) ? "Yes" : "No") << endl;
    while (q--) {
        int l, r;
        char x;
        cin >> l >> r >> x;
        l--;
        r--;
        for (int i = l; i <= r; i++) {
            t[i] = x;
        }
        cout << (all.count(t) ? "Yes" : "No") << endl;
    }
}

Compilation message

Main.cpp: In function 'std::string merge(std::string, std::string)':
Main.cpp:15:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int i = 0; i < a.size(); i++) {
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1112 KB Output is correct
2 Correct 37 ms 856 KB Output is correct
3 Correct 51 ms 852 KB Output is correct
4 Correct 34 ms 1012 KB Output is correct
5 Correct 35 ms 920 KB Output is correct
6 Correct 33 ms 892 KB Output is correct
7 Correct 33 ms 860 KB Output is correct
8 Correct 54 ms 856 KB Output is correct
9 Correct 33 ms 860 KB Output is correct
10 Correct 34 ms 860 KB Output is correct
11 Correct 33 ms 860 KB Output is correct
12 Correct 34 ms 944 KB Output is correct
13 Correct 36 ms 848 KB Output is correct
14 Correct 34 ms 844 KB Output is correct
15 Correct 33 ms 852 KB Output is correct
16 Correct 34 ms 876 KB Output is correct
17 Correct 57 ms 1032 KB Output is correct
18 Correct 47 ms 980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1112 KB Output is correct
2 Correct 37 ms 856 KB Output is correct
3 Correct 51 ms 852 KB Output is correct
4 Correct 34 ms 1012 KB Output is correct
5 Correct 35 ms 920 KB Output is correct
6 Correct 33 ms 892 KB Output is correct
7 Correct 33 ms 860 KB Output is correct
8 Correct 54 ms 856 KB Output is correct
9 Correct 33 ms 860 KB Output is correct
10 Correct 34 ms 860 KB Output is correct
11 Correct 33 ms 860 KB Output is correct
12 Correct 34 ms 944 KB Output is correct
13 Correct 36 ms 848 KB Output is correct
14 Correct 34 ms 844 KB Output is correct
15 Correct 33 ms 852 KB Output is correct
16 Correct 34 ms 876 KB Output is correct
17 Correct 57 ms 1032 KB Output is correct
18 Correct 47 ms 980 KB Output is correct
19 Correct 3240 ms 2432 KB Output is correct
20 Execution timed out 7012 ms 2428 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1112 KB Output is correct
2 Correct 37 ms 856 KB Output is correct
3 Correct 51 ms 852 KB Output is correct
4 Correct 34 ms 1012 KB Output is correct
5 Correct 35 ms 920 KB Output is correct
6 Correct 33 ms 892 KB Output is correct
7 Correct 33 ms 860 KB Output is correct
8 Correct 54 ms 856 KB Output is correct
9 Correct 33 ms 860 KB Output is correct
10 Correct 34 ms 860 KB Output is correct
11 Correct 33 ms 860 KB Output is correct
12 Correct 34 ms 944 KB Output is correct
13 Correct 36 ms 848 KB Output is correct
14 Correct 34 ms 844 KB Output is correct
15 Correct 33 ms 852 KB Output is correct
16 Correct 34 ms 876 KB Output is correct
17 Correct 57 ms 1032 KB Output is correct
18 Correct 47 ms 980 KB Output is correct
19 Correct 36 ms 856 KB Output is correct
20 Correct 45 ms 848 KB Output is correct
21 Correct 36 ms 860 KB Output is correct
22 Correct 31 ms 908 KB Output is correct
23 Correct 35 ms 852 KB Output is correct
24 Correct 34 ms 860 KB Output is correct
25 Correct 36 ms 852 KB Output is correct
26 Correct 33 ms 852 KB Output is correct
27 Correct 36 ms 860 KB Output is correct
28 Correct 32 ms 856 KB Output is correct
29 Correct 35 ms 936 KB Output is correct
30 Correct 32 ms 860 KB Output is correct
31 Correct 38 ms 860 KB Output is correct
32 Correct 37 ms 860 KB Output is correct
33 Correct 37 ms 848 KB Output is correct
34 Correct 40 ms 852 KB Output is correct
35 Correct 38 ms 848 KB Output is correct
36 Correct 37 ms 860 KB Output is correct
37 Correct 37 ms 848 KB Output is correct
38 Correct 37 ms 852 KB Output is correct
39 Correct 37 ms 848 KB Output is correct
40 Correct 37 ms 1028 KB Output is correct
41 Correct 37 ms 848 KB Output is correct
42 Correct 37 ms 860 KB Output is correct
43 Correct 36 ms 860 KB Output is correct
44 Correct 37 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 1112 KB Output is correct
2 Correct 37 ms 856 KB Output is correct
3 Correct 51 ms 852 KB Output is correct
4 Correct 34 ms 1012 KB Output is correct
5 Correct 35 ms 920 KB Output is correct
6 Correct 33 ms 892 KB Output is correct
7 Correct 33 ms 860 KB Output is correct
8 Correct 54 ms 856 KB Output is correct
9 Correct 33 ms 860 KB Output is correct
10 Correct 34 ms 860 KB Output is correct
11 Correct 33 ms 860 KB Output is correct
12 Correct 34 ms 944 KB Output is correct
13 Correct 36 ms 848 KB Output is correct
14 Correct 34 ms 844 KB Output is correct
15 Correct 33 ms 852 KB Output is correct
16 Correct 34 ms 876 KB Output is correct
17 Correct 57 ms 1032 KB Output is correct
18 Correct 47 ms 980 KB Output is correct
19 Correct 3240 ms 2432 KB Output is correct
20 Execution timed out 7012 ms 2428 KB Time limit exceeded
21 Halted 0 ms 0 KB -