답안 #881394

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
881394 2023-12-01T08:19:09 Z Danet Crossing (JOI21_crossing) C++14
26 / 100
7000 ms 5300 KB
#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3")

#define tof_io  ios_base::sync_with_stdio(false);cin.tie(0) , cout.tie(0);
#define double  long double
#define int     long long
#define pb      push_back
#define all(x)  x.begin(),x.end()
#define endl    '\n'

const int mod = 1e9+7; //998244353
const long long inf = 1e18;
const int N = 1e3 + 23;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
vector<string> str;
set<string> st;
vector<string>sz;
string t;
//all==sz;
//str == now;
//dict = st;
char cr(char a , char b)
{
    if(a == b) return a;
    if(a != 'J' and b!='J') return 'J';
    if(a != 'I' and b!='I') return 'I';
    if(a != 'O' and b!='O') return 'O';
    return 'I';
}
string cr2(string a , string b)
{
    string ans;
    for(int i = 0; i < a.size(); i++)
    {
        ans = ans + cr(a[i] , b[i]);
    }
    return ans;
}

int32_t main() 
{
    tof_io;
    int n;
    int q;
    cin >> n;
    string s1 , s2 , s3;
    cin >> s1 >> s2 >> s3;
    str.pb(s1);
    str.pb(s2);
    str.pb(s3);
    while (str.empty() == 0) 
    {
        string re = str.back();
        str.pop_back();
        if (st.find(re) == st.end())
        {
            st.insert(re);
            sz.pb(re);  
            for (string k : sz) 
            {
                str.pb(cr2(re, k));
            }
        }
    }
    cin >> q >> t;
    bool fl = 0;
    for (string x : sz) 
    {
        if (t == x) fl = 1;
    }
    if(fl == 1) cout << "Yes";
    else cout <<"No";
    cout << endl;
    while (q--) 
    {
        int l  , r ;
        char c;
        cin >> l >> r >> c;
        for (int j = l - 1; j <= r - 1; j++)  t[j] = c;
        ///
        bool fl = 0;
        for (string x : sz) 
        {
            if (t == x) fl = 1;
        }
        if(fl == 1) cout << "Yes";
        else cout <<"No";
        cout << endl;
        //
    }
}

Compilation message

Main.cpp: In function 'std::string cr2(std::string, std::string)':
Main.cpp:36:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i = 0; i < a.size(); i++)
      |                    ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 2128 KB Output is correct
2 Correct 41 ms 2200 KB Output is correct
3 Correct 50 ms 2128 KB Output is correct
4 Correct 41 ms 2132 KB Output is correct
5 Correct 39 ms 2128 KB Output is correct
6 Correct 38 ms 1976 KB Output is correct
7 Correct 38 ms 2128 KB Output is correct
8 Correct 40 ms 2176 KB Output is correct
9 Correct 40 ms 2304 KB Output is correct
10 Correct 41 ms 2128 KB Output is correct
11 Correct 40 ms 2280 KB Output is correct
12 Correct 40 ms 2308 KB Output is correct
13 Correct 40 ms 2208 KB Output is correct
14 Correct 40 ms 2132 KB Output is correct
15 Correct 40 ms 2140 KB Output is correct
16 Correct 40 ms 2132 KB Output is correct
17 Correct 40 ms 2104 KB Output is correct
18 Correct 51 ms 2144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 2128 KB Output is correct
2 Correct 41 ms 2200 KB Output is correct
3 Correct 50 ms 2128 KB Output is correct
4 Correct 41 ms 2132 KB Output is correct
5 Correct 39 ms 2128 KB Output is correct
6 Correct 38 ms 1976 KB Output is correct
7 Correct 38 ms 2128 KB Output is correct
8 Correct 40 ms 2176 KB Output is correct
9 Correct 40 ms 2304 KB Output is correct
10 Correct 41 ms 2128 KB Output is correct
11 Correct 40 ms 2280 KB Output is correct
12 Correct 40 ms 2308 KB Output is correct
13 Correct 40 ms 2208 KB Output is correct
14 Correct 40 ms 2132 KB Output is correct
15 Correct 40 ms 2140 KB Output is correct
16 Correct 40 ms 2132 KB Output is correct
17 Correct 40 ms 2104 KB Output is correct
18 Correct 51 ms 2144 KB Output is correct
19 Correct 6118 ms 5300 KB Output is correct
20 Execution timed out 7063 ms 4160 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 2128 KB Output is correct
2 Correct 41 ms 2200 KB Output is correct
3 Correct 50 ms 2128 KB Output is correct
4 Correct 41 ms 2132 KB Output is correct
5 Correct 39 ms 2128 KB Output is correct
6 Correct 38 ms 1976 KB Output is correct
7 Correct 38 ms 2128 KB Output is correct
8 Correct 40 ms 2176 KB Output is correct
9 Correct 40 ms 2304 KB Output is correct
10 Correct 41 ms 2128 KB Output is correct
11 Correct 40 ms 2280 KB Output is correct
12 Correct 40 ms 2308 KB Output is correct
13 Correct 40 ms 2208 KB Output is correct
14 Correct 40 ms 2132 KB Output is correct
15 Correct 40 ms 2140 KB Output is correct
16 Correct 40 ms 2132 KB Output is correct
17 Correct 40 ms 2104 KB Output is correct
18 Correct 51 ms 2144 KB Output is correct
19 Correct 82 ms 792 KB Output is correct
20 Correct 97 ms 904 KB Output is correct
21 Correct 53 ms 1080 KB Output is correct
22 Correct 46 ms 896 KB Output is correct
23 Correct 64 ms 852 KB Output is correct
24 Correct 50 ms 856 KB Output is correct
25 Correct 51 ms 860 KB Output is correct
26 Correct 49 ms 848 KB Output is correct
27 Correct 51 ms 848 KB Output is correct
28 Correct 47 ms 852 KB Output is correct
29 Correct 51 ms 944 KB Output is correct
30 Correct 47 ms 880 KB Output is correct
31 Correct 90 ms 816 KB Output is correct
32 Correct 85 ms 852 KB Output is correct
33 Correct 86 ms 852 KB Output is correct
34 Correct 80 ms 908 KB Output is correct
35 Correct 91 ms 1048 KB Output is correct
36 Correct 86 ms 844 KB Output is correct
37 Correct 87 ms 852 KB Output is correct
38 Correct 85 ms 852 KB Output is correct
39 Correct 94 ms 1248 KB Output is correct
40 Correct 85 ms 852 KB Output is correct
41 Correct 85 ms 848 KB Output is correct
42 Correct 84 ms 848 KB Output is correct
43 Correct 89 ms 1180 KB Output is correct
44 Correct 87 ms 1048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 2128 KB Output is correct
2 Correct 41 ms 2200 KB Output is correct
3 Correct 50 ms 2128 KB Output is correct
4 Correct 41 ms 2132 KB Output is correct
5 Correct 39 ms 2128 KB Output is correct
6 Correct 38 ms 1976 KB Output is correct
7 Correct 38 ms 2128 KB Output is correct
8 Correct 40 ms 2176 KB Output is correct
9 Correct 40 ms 2304 KB Output is correct
10 Correct 41 ms 2128 KB Output is correct
11 Correct 40 ms 2280 KB Output is correct
12 Correct 40 ms 2308 KB Output is correct
13 Correct 40 ms 2208 KB Output is correct
14 Correct 40 ms 2132 KB Output is correct
15 Correct 40 ms 2140 KB Output is correct
16 Correct 40 ms 2132 KB Output is correct
17 Correct 40 ms 2104 KB Output is correct
18 Correct 51 ms 2144 KB Output is correct
19 Correct 6118 ms 5300 KB Output is correct
20 Execution timed out 7063 ms 4160 KB Time limit exceeded
21 Halted 0 ms 0 KB -