提出 #1209092
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit ) for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define sz(s) (int)s.size()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;
ll power(ll x,ll y){
ll t=1;
while(y>0){
if(y%2) y-=1,t=t*x%mod;
else y/=2,x=x*x%mod;
}
return t;
}
char s[N],t[N];
int sv[N],tv[N];
int main(){
int n,m,a,b,c,d,q;
scanf("%s",s);
n=strlen(s);
scanf("%s",t);
m=strlen(t);
REP(i,n){
if (s[i]=='A')
sv[i]=1;
else sv[i]=2;
if (i) sv[i]+=sv[i-1];
}
REP(i,m){
if (t[i]=='A')
tv[i]=1;
else tv[i]=2;
if (i) tv[i]+=tv[i-1];
}
scanf("%d",&q);
REP(i,q){
scanf("%d%d%d%d",&a,&b,&c,&d);
a--,b--,c--,d--;
int x=sv[b];
if (a) x-=sv[a-1];
x%=3;
int y=tv[d];
if (c) y-=tv[c-1];
y%=3;
if (x==y) printf("YES\n");
else printf("NO\n");
}
return 0;
}
提出情報
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:37:15: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s",s);
^
./Main.cpp:39:15: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s",t);
^
./Main.cpp:53:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&q);
^
./Main.cpp:55:32: 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);
^
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
600 / 600 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
0_000.txt, 0_001.txt |
| All |
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 |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 0_000.txt |
AC |
2 ms |
4352 KiB |
| 0_001.txt |
AC |
2 ms |
4352 KiB |
| bound_0.txt |
AC |
34 ms |
7168 KiB |
| bound_1.txt |
AC |
38 ms |
7168 KiB |
| bound_2.txt |
AC |
37 ms |
7168 KiB |
| bound_3.txt |
AC |
40 ms |
7168 KiB |
| min.txt |
AC |
2 ms |
4352 KiB |
| rnd_10000_10.txt |
AC |
39 ms |
7168 KiB |
| rnd_10000_10000.txt |
AC |
39 ms |
7168 KiB |
| rnd_10000_2.txt |
AC |
39 ms |
7168 KiB |
| rnd_10_10.txt |
AC |
39 ms |
7168 KiB |
| rnd_10_10000.txt |
AC |
39 ms |
7168 KiB |
| rnd_10_2.txt |
AC |
39 ms |
7168 KiB |
| rnd_2_10.txt |
AC |
39 ms |
7168 KiB |
| rnd_2_10000.txt |
AC |
39 ms |
7168 KiB |
| rnd_2_2.txt |
AC |
39 ms |
7168 KiB |