結果

問題 No.3032 ホモトピー入門
ユーザー GOTKAKO
提出日時 2025-02-21 23:30:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 786 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 194,932 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-02-21 23:30:29
合計ジャッジ時間 4,053 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
void Yes(){cout << "YES\n";}
void No(){cout << "NO\n";}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T; cin >> T;
    int answer = 0,N; cin >> N;
    while(T--){
        string s; cin >> s;
        int x = 0,y = 0,c1 = 0,c2 = 0;
        for(auto c : s){
            if(c == 'L' && y > 0){
                if(x == 1) c2++;
                if(x == 0) c1++; 
            }
            if(c == 'R' && y > 0){
                if(x == -1) c1++;
                if(x == 0) c2++;
            }
            if(c == 'L') x--;
            else if(c == 'R') x++;
            else if(c == 'U') y++;
            else y--;
        }

        if(c1%2 == 0 && c2%2 == 0) answer++;
    }   
    cout << answer << endl;
}
0