답안 #864273

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
864273 2023-10-22T09:53:57 Z vjudge1 Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 3412 KB
#include <bits/stdc++.h>
using namespace std;

string cross(string a, string b)
{
    string t=a;
    for (int i=0; i<a.size(); i++)
    {
        if (a[i]==b[i])
            t[i]=a[i];
        if (b[i]<a[i])
            swap(a[i], b[i]);
        if (a[i]=='I' && b[i]=='J')
            t[i]='O';
        if (a[i]=='I' && b[i]=='O')
            t[i]='J';
        if (a[i]=='J' && b[i]=='O')
            t[i]='I';
    }

    return t;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, q;
    string a, b, c, p;
    cin >> n;
    cin >> a >> b >> c;
    set<string> s, snew;
    vector<string> v;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
    bool newstring=true;
    int repeat=0;
    while (newstring)
    {
        newstring=false;
        for (int i=0; i<v.size(); i++)
            for (int j=i+1; j<v.size(); j++)
            {
                string t=cross(v[i], v[j]);
                if (s.count(t)==0)
                {
                    snew.insert(t);
                    newstring=true;
                }
            }
        for (auto t : snew)
        {
            s.insert(t);
            v.push_back(t);
        }
        repeat=repeat+1;
    }
    cin >> q;
    cin >> p;
    if (s.count(p))
        cout << "Yes" << '\n';
    else
        cout << "No" << '\n';
    while (q--)
    {
        int l, r;
        char x;
        cin >> l >> r >> x;
        l=l-1;
        r=r-1;
        for (int i=l; i<=r; i++)
            p[i]=x;
        if (s.count(p))
            cout << "Yes" << '\n';
        else
            cout << "No" << '\n';

    }
    /*cout << '\n';
    cout << repeat << '\n';
    cout << "SLAY\n\n";
    for (auto t : v)
        cout << t << '\n';*/

    return 0;
}

Compilation message

Main.cpp: In function 'std::string cross(std::string, std::string)':
Main.cpp:7:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for (int i=0; i<a.size(); i++)
      |                   ~^~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:46:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         for (int i=0; i<v.size(); i++)
      |                       ~^~~~~~~~~
Main.cpp:47:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |             for (int j=i+1; j<v.size(); j++)
      |                             ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 848 KB Output is correct
2 Correct 35 ms 852 KB Output is correct
3 Correct 44 ms 964 KB Output is correct
4 Correct 37 ms 848 KB Output is correct
5 Correct 34 ms 952 KB Output is correct
6 Correct 33 ms 868 KB Output is correct
7 Correct 33 ms 856 KB Output is correct
8 Correct 36 ms 860 KB Output is correct
9 Correct 35 ms 952 KB Output is correct
10 Correct 36 ms 848 KB Output is correct
11 Correct 34 ms 788 KB Output is correct
12 Correct 35 ms 932 KB Output is correct
13 Correct 35 ms 852 KB Output is correct
14 Correct 35 ms 852 KB Output is correct
15 Correct 35 ms 848 KB Output is correct
16 Correct 36 ms 860 KB Output is correct
17 Correct 35 ms 860 KB Output is correct
18 Correct 46 ms 964 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 848 KB Output is correct
2 Correct 35 ms 852 KB Output is correct
3 Correct 44 ms 964 KB Output is correct
4 Correct 37 ms 848 KB Output is correct
5 Correct 34 ms 952 KB Output is correct
6 Correct 33 ms 868 KB Output is correct
7 Correct 33 ms 856 KB Output is correct
8 Correct 36 ms 860 KB Output is correct
9 Correct 35 ms 952 KB Output is correct
10 Correct 36 ms 848 KB Output is correct
11 Correct 34 ms 788 KB Output is correct
12 Correct 35 ms 932 KB Output is correct
13 Correct 35 ms 852 KB Output is correct
14 Correct 35 ms 852 KB Output is correct
15 Correct 35 ms 848 KB Output is correct
16 Correct 36 ms 860 KB Output is correct
17 Correct 35 ms 860 KB Output is correct
18 Correct 46 ms 964 KB Output is correct
19 Correct 6302 ms 3412 KB Output is correct
20 Execution timed out 7011 ms 2800 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 848 KB Output is correct
2 Correct 35 ms 852 KB Output is correct
3 Correct 44 ms 964 KB Output is correct
4 Correct 37 ms 848 KB Output is correct
5 Correct 34 ms 952 KB Output is correct
6 Correct 33 ms 868 KB Output is correct
7 Correct 33 ms 856 KB Output is correct
8 Correct 36 ms 860 KB Output is correct
9 Correct 35 ms 952 KB Output is correct
10 Correct 36 ms 848 KB Output is correct
11 Correct 34 ms 788 KB Output is correct
12 Correct 35 ms 932 KB Output is correct
13 Correct 35 ms 852 KB Output is correct
14 Correct 35 ms 852 KB Output is correct
15 Correct 35 ms 848 KB Output is correct
16 Correct 36 ms 860 KB Output is correct
17 Correct 35 ms 860 KB Output is correct
18 Correct 46 ms 964 KB Output is correct
19 Correct 44 ms 860 KB Output is correct
20 Correct 51 ms 1012 KB Output is correct
21 Correct 39 ms 972 KB Output is correct
22 Correct 35 ms 812 KB Output is correct
23 Correct 37 ms 1036 KB Output is correct
24 Correct 55 ms 848 KB Output is correct
25 Correct 38 ms 860 KB Output is correct
26 Correct 35 ms 996 KB Output is correct
27 Correct 37 ms 856 KB Output is correct
28 Correct 33 ms 928 KB Output is correct
29 Correct 40 ms 1008 KB Output is correct
30 Correct 33 ms 848 KB Output is correct
31 Correct 39 ms 836 KB Output is correct
32 Correct 39 ms 1040 KB Output is correct
33 Correct 58 ms 844 KB Output is correct
34 Correct 36 ms 860 KB Output is correct
35 Correct 40 ms 1028 KB Output is correct
36 Correct 39 ms 872 KB Output is correct
37 Correct 38 ms 848 KB Output is correct
38 Correct 38 ms 860 KB Output is correct
39 Correct 39 ms 852 KB Output is correct
40 Correct 38 ms 816 KB Output is correct
41 Correct 38 ms 852 KB Output is correct
42 Correct 53 ms 980 KB Output is correct
43 Correct 37 ms 860 KB Output is correct
44 Correct 38 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 848 KB Output is correct
2 Correct 35 ms 852 KB Output is correct
3 Correct 44 ms 964 KB Output is correct
4 Correct 37 ms 848 KB Output is correct
5 Correct 34 ms 952 KB Output is correct
6 Correct 33 ms 868 KB Output is correct
7 Correct 33 ms 856 KB Output is correct
8 Correct 36 ms 860 KB Output is correct
9 Correct 35 ms 952 KB Output is correct
10 Correct 36 ms 848 KB Output is correct
11 Correct 34 ms 788 KB Output is correct
12 Correct 35 ms 932 KB Output is correct
13 Correct 35 ms 852 KB Output is correct
14 Correct 35 ms 852 KB Output is correct
15 Correct 35 ms 848 KB Output is correct
16 Correct 36 ms 860 KB Output is correct
17 Correct 35 ms 860 KB Output is correct
18 Correct 46 ms 964 KB Output is correct
19 Correct 6302 ms 3412 KB Output is correct
20 Execution timed out 7011 ms 2800 KB Time limit exceeded
21 Halted 0 ms 0 KB -