Submission #881351

# Submission time Handle Problem Language Result Execution time Memory
881351 2023-12-01T07:31:20 Z Danet Crossing (JOI21_crossing) C++14
0 / 100
42 ms 1012 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 s;
void cm(string b){for (string a : sz){if(a == b) {cout << "Yes" << endl;return;}}cout << "No";cout << endl;}

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';
}
string cr2(string a , string b)
{
    string ans = "";
    for(int i = 0; i < a.length(); i++)
    {
        ans = ans + cr(a[i] , b[i]);
    }
    return ans;
}
void ps(){for (string a : sz){str.pb(cr2(s, a));}}

int32_t main() 
{
    tof_io;
    int n;
    int q;
    cin >> n;
    string t;
    string s1 , s2 , s3;
    cin >> s1 >> s2 >> s3;
    str.pb(s1);
    str.pb(s2);
    str.pb(s3);
    while (str.empty() == 0) 
    {
        s = str.back();
        str.pop_back();
        if (st.find(s) == st.end())
        {
            st.insert(s);
            sz.pb(s);  
            ps();
        }
    }
    cin >> q >> t;
    cm(t);
    int i = 0;
    while (q--) 
    {
        int l  , r , c;
        cin >> l >> r >> c;
        for (int j = l - 1; j <= r - 1; j++)  t[j] = c;
        cm(t);
        i++;
    }
}

Compilation message

Main.cpp: In function 'std::string cr2(std::string, std::string)':
Main.cpp:34:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int i = 0; i < a.length(); i++)
      |                    ~~^~~~~~~~~~~~
Main.cpp: In function 'char cr(char, char)':
Main.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 21 ms 860 KB Output is correct
2 Correct 31 ms 856 KB Output is correct
3 Correct 42 ms 860 KB Output is correct
4 Incorrect 37 ms 1012 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 860 KB Output is correct
2 Correct 31 ms 856 KB Output is correct
3 Correct 42 ms 860 KB Output is correct
4 Incorrect 37 ms 1012 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 860 KB Output is correct
2 Correct 31 ms 856 KB Output is correct
3 Correct 42 ms 860 KB Output is correct
4 Incorrect 37 ms 1012 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 860 KB Output is correct
2 Correct 31 ms 856 KB Output is correct
3 Correct 42 ms 860 KB Output is correct
4 Incorrect 37 ms 1012 KB Output isn't correct
5 Halted 0 ms 0 KB -