Submission #881346

# Submission time Handle Problem Language Result Execution time Memory
881346 2023-12-01T07:21:19 Z Iliya_ Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 6708 KB
//IN THE NAME OF GOD
#include<bits/stdc++.h>
#pragma GCC optimize("O2,unroll-loops")
#define endl        '\n'
#define F           first
#define S           second
#define pii         pair<int,int>
#define all(x)      x.begin(),x.end()
#define pb          push_back
#define fastio      ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll; 
typedef long double dll;

vector<string> vec; 

string merge(string a, string b){
     string make = "";
     for(int i=0; i<int(a.size()); i++){
          if (a[i] == b[i]) make += a[i]; 
          else{
               if ((a[i] == 'O' && b[i] == 'J') || (a[i] == 'J' && b[i] == 'O')) make+='I';
               if ((a[i] == 'O' && b[i] == 'I') || (a[i] == 'I' && b[i] == 'O')) make+='J';
               if ((a[i] == 'I' && b[i] == 'J') || (a[i] == 'J' && b[i] == 'I')) make+='O';
          }
     }
     return make; 
}

int32_t main(){
     fastio;

     int n; cin >> n; 
     string a,b,c; cin >> a >> b >> c;
     vec.pb(a); 
     vec.pb(b); 
     vec.pb(c);
     for(int i=0; i<3; i++){
          for(int j=0; j<3; j++){
               if (i == j) continue; 
               vec.pb(merge(vec[i],vec[j])); 
          }
     }
     for(int i=0; i<3; i++){
          for(int j=0; j<3; j++){
               if (i == j) continue; 
               for(int k =0; k<3; k++){
                    if (k == i || k == j) continue; 
                    vec.pb(merge(merge(vec[i],vec[j]),vec[k]));
               }
          }
     }
     int q; cin >> q; 
     string t; cin >> t; 
     bool ans = false; 
     for(string cur : vec) if (cur == t) ans = true; 
     cout << (ans ? "Yes" : "No") << endl;
     while(q--){
          int l,r; cin >> l >> r; l--; r--;
          char c; cin >> c; 
          for(int i=l;i<=r; i++) t[i] = c; 
          bool ans = false; 
          for(string cur : vec) if (cur == t) ans = true; 
          cout << (ans ? "Yes" : "No") << endl;
     }

     return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 107 ms 1880 KB Output is correct
2 Correct 115 ms 1876 KB Output is correct
3 Correct 123 ms 1876 KB Output is correct
4 Correct 118 ms 1992 KB Output is correct
5 Correct 110 ms 1896 KB Output is correct
6 Correct 111 ms 1964 KB Output is correct
7 Correct 128 ms 1844 KB Output is correct
8 Correct 117 ms 1872 KB Output is correct
9 Correct 117 ms 2028 KB Output is correct
10 Correct 115 ms 2012 KB Output is correct
11 Correct 118 ms 2004 KB Output is correct
12 Correct 117 ms 1872 KB Output is correct
13 Correct 114 ms 1876 KB Output is correct
14 Correct 140 ms 1876 KB Output is correct
15 Correct 115 ms 2016 KB Output is correct
16 Correct 115 ms 2016 KB Output is correct
17 Correct 115 ms 1912 KB Output is correct
18 Correct 127 ms 1872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 1880 KB Output is correct
2 Correct 115 ms 1876 KB Output is correct
3 Correct 123 ms 1876 KB Output is correct
4 Correct 118 ms 1992 KB Output is correct
5 Correct 110 ms 1896 KB Output is correct
6 Correct 111 ms 1964 KB Output is correct
7 Correct 128 ms 1844 KB Output is correct
8 Correct 117 ms 1872 KB Output is correct
9 Correct 117 ms 2028 KB Output is correct
10 Correct 115 ms 2012 KB Output is correct
11 Correct 118 ms 2004 KB Output is correct
12 Correct 117 ms 1872 KB Output is correct
13 Correct 114 ms 1876 KB Output is correct
14 Correct 140 ms 1876 KB Output is correct
15 Correct 115 ms 2016 KB Output is correct
16 Correct 115 ms 2016 KB Output is correct
17 Correct 115 ms 1912 KB Output is correct
18 Correct 127 ms 1872 KB Output is correct
19 Execution timed out 7008 ms 6708 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 107 ms 1880 KB Output is correct
2 Correct 115 ms 1876 KB Output is correct
3 Correct 123 ms 1876 KB Output is correct
4 Correct 118 ms 1992 KB Output is correct
5 Correct 110 ms 1896 KB Output is correct
6 Correct 111 ms 1964 KB Output is correct
7 Correct 128 ms 1844 KB Output is correct
8 Correct 117 ms 1872 KB Output is correct
9 Correct 117 ms 2028 KB Output is correct
10 Correct 115 ms 2012 KB Output is correct
11 Correct 118 ms 2004 KB Output is correct
12 Correct 117 ms 1872 KB Output is correct
13 Correct 114 ms 1876 KB Output is correct
14 Correct 140 ms 1876 KB Output is correct
15 Correct 115 ms 2016 KB Output is correct
16 Correct 115 ms 2016 KB Output is correct
17 Correct 115 ms 1912 KB Output is correct
18 Correct 127 ms 1872 KB Output is correct
19 Correct 109 ms 1872 KB Output is correct
20 Correct 123 ms 1872 KB Output is correct
21 Correct 129 ms 2400 KB Output is correct
22 Correct 108 ms 2104 KB Output is correct
23 Correct 115 ms 2148 KB Output is correct
24 Correct 112 ms 2132 KB Output is correct
25 Correct 120 ms 2640 KB Output is correct
26 Correct 112 ms 2208 KB Output is correct
27 Correct 116 ms 2064 KB Output is correct
28 Correct 105 ms 1872 KB Output is correct
29 Correct 120 ms 2480 KB Output is correct
30 Correct 107 ms 2132 KB Output is correct
31 Correct 119 ms 2132 KB Output is correct
32 Correct 117 ms 2132 KB Output is correct
33 Correct 120 ms 2176 KB Output is correct
34 Correct 108 ms 2132 KB Output is correct
35 Correct 116 ms 2108 KB Output is correct
36 Correct 114 ms 2088 KB Output is correct
37 Correct 116 ms 2296 KB Output is correct
38 Correct 116 ms 2132 KB Output is correct
39 Correct 114 ms 2068 KB Output is correct
40 Correct 114 ms 2236 KB Output is correct
41 Correct 116 ms 2140 KB Output is correct
42 Correct 115 ms 2132 KB Output is correct
43 Correct 114 ms 2032 KB Output is correct
44 Correct 118 ms 2400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 1880 KB Output is correct
2 Correct 115 ms 1876 KB Output is correct
3 Correct 123 ms 1876 KB Output is correct
4 Correct 118 ms 1992 KB Output is correct
5 Correct 110 ms 1896 KB Output is correct
6 Correct 111 ms 1964 KB Output is correct
7 Correct 128 ms 1844 KB Output is correct
8 Correct 117 ms 1872 KB Output is correct
9 Correct 117 ms 2028 KB Output is correct
10 Correct 115 ms 2012 KB Output is correct
11 Correct 118 ms 2004 KB Output is correct
12 Correct 117 ms 1872 KB Output is correct
13 Correct 114 ms 1876 KB Output is correct
14 Correct 140 ms 1876 KB Output is correct
15 Correct 115 ms 2016 KB Output is correct
16 Correct 115 ms 2016 KB Output is correct
17 Correct 115 ms 1912 KB Output is correct
18 Correct 127 ms 1872 KB Output is correct
19 Execution timed out 7008 ms 6708 KB Time limit exceeded
20 Halted 0 ms 0 KB -