結果
| 問題 | No.3032 ホモトピー入門 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-21 22:49:23 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 666 bytes |
| 記録 | |
| コンパイル時間 | 3,537 ms |
| コンパイル使用メモリ | 274,988 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-02-21 22:49:30 |
| 合計ジャッジ時間 | 5,989 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 28 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define all(a) begin(a),end(a)
#define sz(a) (int)(a).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const ll mod=998244353;
int main(){
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
int N,M;cin>>N>>M;
int ans=0;
while(N--){
string S;cin>>S;
ll a1=0,a2=0,x=0,y=0;
rep(i,0,sz(S)){
ll _x=x,_y=y;
if(S[i]=='L')x--;
else if(S[i]=='R')x++;
else if(S[i]=='U')y++;
else y--;
a1+=(2*_x-1)*(2*y-1)-(2*x-1)*(2*_y-1);
a2+=(2*_x+1)*(2*y-1)-(2*x+1)*(2*_y-1);
}
if(a1==0&&a2==0)ans++;
}
cout<<ans<<endl;
}