답안 #847472

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
847472 2023-09-09T17:21:41 Z Mr_Ph Crossing (JOI21_crossing) C++14
26 / 100
7000 ms 5688 KB
///Never gonna give you up.
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
using namespace __gnu_pbds;
template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;
const ll mod=(ll)1e9+7;
const ll mod1=998244353;
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
#define int long long
string cross(string a,string b)
{
    string ans;
    for(int i=0; i<a.sz; i++)
    {
        if(a[i]==b[i])
            ans+=a[i];
        else
        {
            set<char>st;
            st.insert('J');
            st.insert('O');
            st.insert('I');
            st.erase(a[i]);
            st.erase(b[i]);
            ans+=*st.begin();
        }
    }
    return ans;
}
void preprocess() {}
void solve()
{
    int n;
    cin>>n;
    string s1,s2,s3;
    cin>>s1>>s2>>s3;
    set<string>st;
    st.insert(s1);
    st.insert(s2);
    st.insert(s3);
    while(true)
    {
        int x=st.sz;
        for(auto i:st)
            for(auto j:st)
                st.insert(cross(i,j));
        if(x==st.sz)
            break;
    }
    int q;
    string t;
    cin>>q>>t;
    if(st.find(t)!=st.end())
    cout<<"Yes"<<endl;
    else
        cout<<"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;
        if(st.find(t)!=st.end())
        cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}
signed main()
{
    // freopen("div7.in","r",stdin);
    //freopen("div7.out","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    preprocess();
    //bla();
    int t=1;
    //cin>>t;
    while(t--)
        solve();
}

Compilation message

Main.cpp: In function 'std::string cross(std::string, std::string)':
Main.cpp:26:19: 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]
   26 |     for(int i=0; i<a.sz; i++)
      |                   ^
Main.cpp: In function 'void solve()':
Main.cpp:60:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::set<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |         if(x==st.sz)
      |             ^
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 2288 KB Output is correct
2 Correct 37 ms 2384 KB Output is correct
3 Correct 45 ms 2384 KB Output is correct
4 Correct 35 ms 2384 KB Output is correct
5 Correct 39 ms 2384 KB Output is correct
6 Correct 36 ms 2384 KB Output is correct
7 Correct 35 ms 2384 KB Output is correct
8 Correct 36 ms 2500 KB Output is correct
9 Correct 35 ms 2384 KB Output is correct
10 Correct 36 ms 2572 KB Output is correct
11 Correct 36 ms 2384 KB Output is correct
12 Correct 36 ms 2388 KB Output is correct
13 Correct 35 ms 2556 KB Output is correct
14 Correct 36 ms 2432 KB Output is correct
15 Correct 37 ms 2384 KB Output is correct
16 Correct 36 ms 2384 KB Output is correct
17 Correct 37 ms 2640 KB Output is correct
18 Correct 45 ms 2384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 2288 KB Output is correct
2 Correct 37 ms 2384 KB Output is correct
3 Correct 45 ms 2384 KB Output is correct
4 Correct 35 ms 2384 KB Output is correct
5 Correct 39 ms 2384 KB Output is correct
6 Correct 36 ms 2384 KB Output is correct
7 Correct 35 ms 2384 KB Output is correct
8 Correct 36 ms 2500 KB Output is correct
9 Correct 35 ms 2384 KB Output is correct
10 Correct 36 ms 2572 KB Output is correct
11 Correct 36 ms 2384 KB Output is correct
12 Correct 36 ms 2388 KB Output is correct
13 Correct 35 ms 2556 KB Output is correct
14 Correct 36 ms 2432 KB Output is correct
15 Correct 37 ms 2384 KB Output is correct
16 Correct 36 ms 2384 KB Output is correct
17 Correct 37 ms 2640 KB Output is correct
18 Correct 45 ms 2384 KB Output is correct
19 Correct 5242 ms 5688 KB Output is correct
20 Execution timed out 7001 ms 3976 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 2288 KB Output is correct
2 Correct 37 ms 2384 KB Output is correct
3 Correct 45 ms 2384 KB Output is correct
4 Correct 35 ms 2384 KB Output is correct
5 Correct 39 ms 2384 KB Output is correct
6 Correct 36 ms 2384 KB Output is correct
7 Correct 35 ms 2384 KB Output is correct
8 Correct 36 ms 2500 KB Output is correct
9 Correct 35 ms 2384 KB Output is correct
10 Correct 36 ms 2572 KB Output is correct
11 Correct 36 ms 2384 KB Output is correct
12 Correct 36 ms 2388 KB Output is correct
13 Correct 35 ms 2556 KB Output is correct
14 Correct 36 ms 2432 KB Output is correct
15 Correct 37 ms 2384 KB Output is correct
16 Correct 36 ms 2384 KB Output is correct
17 Correct 37 ms 2640 KB Output is correct
18 Correct 45 ms 2384 KB Output is correct
19 Correct 39 ms 2648 KB Output is correct
20 Correct 50 ms 2356 KB Output is correct
21 Correct 38 ms 2456 KB Output is correct
22 Correct 36 ms 2128 KB Output is correct
23 Correct 38 ms 2392 KB Output is correct
24 Correct 36 ms 2384 KB Output is correct
25 Correct 37 ms 2356 KB Output is correct
26 Correct 35 ms 2384 KB Output is correct
27 Correct 38 ms 2384 KB Output is correct
28 Correct 34 ms 2132 KB Output is correct
29 Correct 38 ms 2384 KB Output is correct
30 Correct 35 ms 2384 KB Output is correct
31 Correct 40 ms 2492 KB Output is correct
32 Correct 40 ms 2384 KB Output is correct
33 Correct 42 ms 2384 KB Output is correct
34 Correct 37 ms 2384 KB Output is correct
35 Correct 40 ms 2384 KB Output is correct
36 Correct 40 ms 2476 KB Output is correct
37 Correct 41 ms 2384 KB Output is correct
38 Correct 42 ms 2500 KB Output is correct
39 Correct 41 ms 2384 KB Output is correct
40 Correct 39 ms 2516 KB Output is correct
41 Correct 40 ms 2384 KB Output is correct
42 Correct 39 ms 2384 KB Output is correct
43 Correct 38 ms 2360 KB Output is correct
44 Correct 42 ms 2536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 2288 KB Output is correct
2 Correct 37 ms 2384 KB Output is correct
3 Correct 45 ms 2384 KB Output is correct
4 Correct 35 ms 2384 KB Output is correct
5 Correct 39 ms 2384 KB Output is correct
6 Correct 36 ms 2384 KB Output is correct
7 Correct 35 ms 2384 KB Output is correct
8 Correct 36 ms 2500 KB Output is correct
9 Correct 35 ms 2384 KB Output is correct
10 Correct 36 ms 2572 KB Output is correct
11 Correct 36 ms 2384 KB Output is correct
12 Correct 36 ms 2388 KB Output is correct
13 Correct 35 ms 2556 KB Output is correct
14 Correct 36 ms 2432 KB Output is correct
15 Correct 37 ms 2384 KB Output is correct
16 Correct 36 ms 2384 KB Output is correct
17 Correct 37 ms 2640 KB Output is correct
18 Correct 45 ms 2384 KB Output is correct
19 Correct 5242 ms 5688 KB Output is correct
20 Execution timed out 7001 ms 3976 KB Time limit exceeded
21 Halted 0 ms 0 KB -