結果

問題 No.351 市松スライドパズル
ユーザー izryt(趣味)izryt(趣味)
提出日時 2016-03-12 04:51:08
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 1,657 bytes
コンパイル時間 659 ms
コンパイル使用メモリ 81,892 KB
実行使用メモリ 8,584 KB
最終ジャッジ日時 2023-10-25 07:29:28
合計ジャッジ時間 3,147 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
8,584 KB
testcase_01 AC 2 ms
5,752 KB
testcase_02 AC 2 ms
5,752 KB
testcase_03 AC 2 ms
5,752 KB
testcase_04 AC 2 ms
5,752 KB
testcase_05 AC 2 ms
5,752 KB
testcase_06 AC 2 ms
5,752 KB
testcase_07 AC 2 ms
5,752 KB
testcase_08 AC 2 ms
5,752 KB
testcase_09 AC 2 ms
5,752 KB
testcase_10 AC 2 ms
5,752 KB
testcase_11 AC 2 ms
5,752 KB
testcase_12 AC 2 ms
5,752 KB
testcase_13 AC 126 ms
8,564 KB
testcase_14 AC 124 ms
8,568 KB
testcase_15 AC 125 ms
8,584 KB
testcase_16 AC 123 ms
8,584 KB
testcase_17 AC 124 ms
8,584 KB
testcase_18 AC 125 ms
8,584 KB
testcase_19 AC 123 ms
8,584 KB
testcase_20 AC 129 ms
8,584 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:51:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   51 |     int H, W; scanf("%d%d", &H, &W);
      |               ~~~~~^~~~~~~~~~~~~~~~
main.cpp:52:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   52 |     int N; scanf("%d", &N);
      |            ~~~~~^~~~~~~~~~
main.cpp:54:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   54 |     rep(i, N) scanf(" %c%d", s + i, k + i);
      |               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;

char s[1000001];
int k[1000001];

signed main()
{
    int H, W; scanf("%d%d", &H, &W);
    int N; scanf("%d", &N);

    rep(i, N) scanf(" %c%d", s + i, k + i);

    int r = 0, c = 0;

    rrep(i, N) {
        if (s[i] == 'R' && k[i] == r) {
            c = (c + W - 1) % W;
        } else if (s[i] == 'C' && k[i] == c) {
            r = (r + H - 1) % H;
        }
    }

    puts((r + c) & 1 ? "black" : "white");
}
0