Submission #1209120


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(int _##i = (t), i = (f); i <  _##i; i++)
#define downto(f, t, i)  for(int _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(int _##i = (t), i = (f); i >  _##i; i--)
typedef long double ld;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
    #define debug true
    #define ln << endl
#else
    #define debug false
    #define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '

int Sc[100001], Tc[100001];

signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    Sc[0] = Tc[0] = 0;

    int s = 0;
    while(true) {
        char c = getchar();
        if(c == 'A') {
            Sc[s+1] = Sc[s] + 1;
        } else if(c == 'B') {
            Sc[s+1] = Sc[s] + 2;
        } else break;
        s++;
    }

    int t = 0;
    while(true) {
        char c = getchar();
        if(c == 'A') {
            Tc[t+1] = Tc[t] + 1;
        } else if(c == 'B') {
            Tc[t+1] = Tc[t] + 2;
        } else break;
        t++;
    }
    
    int Q;
    scanf("%d",&Q);
    times(Q, i) {
        int A, B, C, D;
        scanf("%d%d%d%d",&A,&B,&C,&D);
        if((Sc[B] - Sc[A-1]) % 3 == (Tc[D] - Tc[C-1]) % 3)
            printf("YES\n");
        else
            printf("NO\n");
    }

    return 0;
}

Submission Info

Submission Time
Task E - TrBBnsformBBtion
User akouryy
Language C++14 (GCC 5.4.1)
Score 600
Code Size 1590 Byte
Status
Exec Time 38 ms
Memory 1536 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:56:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&Q);
                   ^
./Main.cpp:59:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d%d",&A,&B,&C,&D);
                                      ^

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt
All 600 / 600 0_000.txt, 0_001.txt, bound_0.txt, bound_1.txt, bound_2.txt, bound_3.txt, min.txt, rnd_10000_10.txt, rnd_10000_10000.txt, rnd_10000_2.txt, rnd_10_10.txt, rnd_10_10000.txt, rnd_10_2.txt, rnd_2_10.txt, rnd_2_10000.txt, rnd_2_2.txt
Case Name Status Exec Time Memory
0_000.txt 1 ms 256 KB
0_001.txt 1 ms 256 KB
bound_0.txt 33 ms 1408 KB
bound_1.txt 36 ms 1408 KB
bound_2.txt 36 ms 1408 KB
bound_3.txt 38 ms 1536 KB
min.txt 1 ms 256 KB
rnd_10000_10.txt 38 ms 1408 KB
rnd_10000_10000.txt 38 ms 1408 KB
rnd_10000_2.txt 38 ms 1408 KB
rnd_10_10.txt 38 ms 1408 KB
rnd_10_10000.txt 38 ms 1408 KB
rnd_10_2.txt 38 ms 1408 KB
rnd_2_10.txt 38 ms 1408 KB
rnd_2_10000.txt 38 ms 1408 KB
rnd_2_2.txt 38 ms 1408 KB