結果

問題 No.1613 Rush and Remove
ユーザー tko919tko919
提出日時 2021-08-24 01:35:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 1,634 bytes
コンパイル時間 2,127 ms
コンパイル使用メモリ 203,780 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 23:03:37
合計ジャッジ時間 3,633 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 6 ms
6,940 KB
testcase_10 AC 5 ms
6,944 KB
testcase_11 AC 6 ms
6,944 KB
testcase_12 AC 6 ms
6,940 KB
testcase_13 AC 5 ms
6,944 KB
testcase_14 AC 6 ms
6,944 KB
testcase_15 AC 5 ms
6,940 KB
testcase_16 AC 5 ms
6,940 KB
testcase_17 AC 6 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 1 ms
6,940 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 1 ms
6,944 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 1 ms
6,944 KB
testcase_26 AC 2 ms
6,944 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 1 ms
6,944 KB
testcase_33 AC 1 ms
6,944 KB
testcase_34 AC 1 ms
6,944 KB
testcase_35 AC 2 ms
6,944 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 1 ms
6,944 KB
testcase_39 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
using ll=long long int;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

ll mod(ll a,ll m){return (a%m+m)%m;}
ll mpow(ll a,ll t,ll m){
   ll res=1;
   while(t){
      if(t&1)res=mod(res*a,m);
      a=mod(a*a,m); t>>=1;
   } return res;
}
ll minv(ll a,ll m){
   ll b=m,u=1,v=0;
   while(b){
      ll t=a/b;
      a-=t*b; swap(a,b);
      u-=t*v; swap(u,v);
   } u=mod(u,m); return u;
}
int get_root(int p){ //primitive root
   vector<int> ds;
   for(int x=1;x*x<=p-1;x++)if((p-1)%x==0){
      ds.push_back(x);
      if(x*x!=p-1)ds.push_back((p-1)/x);
   }
   sort(ALL(ds));
   ds.pop_back();
   for(int x=1;x<p;x++){
      for(auto& d:ds){
         if(mpow(x,d,p)==1)goto fail;
      }
      return x;
      fail:;
   } assert(0);
}

int main(){
   int h,w;
   cin>>h>>w;
   vector<string> g(h);
   rep(i,0,h)cin>>g[i];
   int res=0;
   rep(j,0,w){
      int sub=0;
      rep(i,0,h)if(g[i][j]=='o')sub=(sub+mpow(2,i,3))%3;
      res^=sub;
   }
   if(res)puts("First");
   else puts("Second");

   // int g[21]={};
   // rep(x,1,15){
   //    set<int> st;
   //    rep(d,0,6)if(x-(1<<d)>=0)st.insert(g[x-(1<<d)]);
   //    rep(G,0,st.size()+1)if(!st.count(G)){
   //       g[x]=G;
   //       break;
   //    }
   //    cout<<g[x]<<'\n';
   // }
   return 0;
}
0