提出 #51551581


ソースコード 拡げる

/*
You have the right to work only but never to its fruits.
Let not the fruits of action be your motive, nor let your attachment be to inaction.
*/
#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(), v.end()
#define ll long long
#define wishOneDay ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define endl '\n';

void solve(){
    string s = "wbwbwwbwbwbw";
    int a, b;
    cin >> a >> b;
    int k = 15;
    while( k-- ) s += s;
    // cout << s.size();
    int tot = a + b;
    int foundA = 0, foundB = 0;
    for(int i = 0; i < tot; i++){
        foundA += s[i] == 'w';
        foundB += s[i] == 'b';
    }
    bool flag = 0;
    flag |= foundA == a && foundB == b;
    for(int i = tot; i < s.size(); i++){
        foundA += s[i] == 'w';
        foundB += s[i] == 'b';
        foundA -= s[i - tot] == 'w';
        foundB -= s[i - tot] == 'b';
        flag |= foundA == a && foundB == b;
    }
    if( flag ) cout << "Yes";
    else cout << "No";
}

int main(){

    wishOneDay

    int tc = 1;
    // cin >> tc;
    while( tc-- ) solve(), cout << endl;
    return 0;

}

提出情報

提出日時
問題 B - Piano
ユーザ prabhxs
言語 C++ 20 (gcc 12.2)
得点 200
コード長 1147 Byte
結果 AC
実行時間 2 ms
メモリ 3848 KiB

コンパイルエラー

Main.cpp: In function ‘void solve()’:
Main.cpp:28:24: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   28 |     for(int i = tot; i < s.size(); i++){
      |                      ~~^~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 22
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_yes_00.txt, 01_random_yes_01.txt, 02_random_yes_2_00.txt, 02_random_yes_2_01.txt, 02_random_yes_2_02.txt, 02_random_yes_2_03.txt, 03_random_no_00.txt, 03_random_no_01.txt, 04_random_no_2_00.txt, 04_random_no_2_01.txt, 04_random_no_2_02.txt, 04_random_no_2_03.txt, 05_handmade_00.txt, 05_handmade_01.txt, 05_handmade_02.txt, 05_handmade_03.txt, 05_handmade_04.txt, 05_handmade_05.txt, 05_handmade_06.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 2 ms 3780 KiB
00_sample_01.txt AC 2 ms 3840 KiB
00_sample_02.txt AC 2 ms 3764 KiB
01_random_yes_00.txt AC 2 ms 3716 KiB
01_random_yes_01.txt AC 2 ms 3716 KiB
02_random_yes_2_00.txt AC 2 ms 3760 KiB
02_random_yes_2_01.txt AC 2 ms 3800 KiB
02_random_yes_2_02.txt AC 2 ms 3848 KiB
02_random_yes_2_03.txt AC 2 ms 3672 KiB
03_random_no_00.txt AC 2 ms 3632 KiB
03_random_no_01.txt AC 2 ms 3832 KiB
04_random_no_2_00.txt AC 2 ms 3840 KiB
04_random_no_2_01.txt AC 2 ms 3720 KiB
04_random_no_2_02.txt AC 2 ms 3808 KiB
04_random_no_2_03.txt AC 2 ms 3736 KiB
05_handmade_00.txt AC 2 ms 3780 KiB
05_handmade_01.txt AC 2 ms 3836 KiB
05_handmade_02.txt AC 2 ms 3744 KiB
05_handmade_03.txt AC 2 ms 3752 KiB
05_handmade_04.txt AC 2 ms 3708 KiB
05_handmade_05.txt AC 2 ms 3652 KiB
05_handmade_06.txt AC 2 ms 3720 KiB