結果
問題 | No.2251 Marking Grid |
ユーザー | bayashiko |
提出日時 | 2023-03-07 21:58:07 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,849 bytes |
コンパイル時間 | 4,903 ms |
コンパイル使用メモリ | 279,768 KB |
実行使用メモリ | 7,760 KB |
最終ジャッジ日時 | 2023-10-18 05:39:07 |
合計ジャッジ時間 | 11,487 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 131 ms
4,348 KB |
testcase_03 | AC | 2 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 2 ms
4,348 KB |
testcase_09 | AC | 2 ms
4,348 KB |
testcase_10 | AC | 130 ms
4,348 KB |
testcase_11 | AC | 2 ms
4,348 KB |
testcase_12 | AC | 38 ms
4,348 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | TLE | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
ソースコード
#include<bits/stdc++.h> #pragma GCC optimize("Ofast") //#pragma GCC target("avx2") #pragma GCC optimize("unroll-loops") using namespace std; //#include<boost/multiprecision/cpp_int.hpp> //#include<boost/multiprecision/cpp_dec_float.hpp> //namespace mp=boost::multiprecision; //#define mulint mp::cpp_int //#define mulfloat mp::cpp_dec_float_100 struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init; //#define INF (1<<30) #define LINF (lint)(1LL<<56) #define MINF (lint)(2e18) #define endl "\n" #define rep(i,n) for(lint (i)=0;(i)<(n);(i)++) #define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--) #define flc(x) __builtin_popcountll(x) #define pint pair<int,int> #define pdouble pair<double,double> #define plint pair<lint,lint> #define fi first #define se second #define all(x) x.begin(),x.end() //#define vec vector<lint> #define nep(x) next_permutation(all(x)) typedef long long lint; int dx[8]={1,1,0,-1,-1,-1,0,1}; int dy[8]={0,1,1,1,0,-1,-1,-1}; const int MAX_N=3e5+5; template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;} //vector<int> bucket[MAX_N/1000]; //constexpr int MOD=1000000007; constexpr int MOD=998244353; //typedef __int128_t llint; #include<atcoder/all> using namespace atcoder; int main(void){ int H,W; cin >> H >> W; lint A[H][W]; rep(i,H) rep(j,W) cin >> A[i][j]; lint naive_ans=0; rep(i,(1<<(H*W))){ int M[H][W]={}; lint maxi=0; rep(j,H) rep(k,W){ if(i&(1<<(j*W+k))) M[j][k]=1,chmax(maxi,A[j][k]); } bool ok=true; rep(j,H-1) rep(k,W-1){ int sum=M[j][k]+M[j+1][k]+M[j][k+1]+M[j+1][k+1]; if(sum%2) ok=false; } if(ok) naive_ans+=maxi,naive_ans%=MOD; } cout << naive_ans << endl; /*lint ans=0; rep(i,(1<<H)) rep(j,(1<<W)){ bool M[H][W]={}; rep(k,H){ if(i&(1<<k)){ rep(l,W) M[k][l]^=1; } } rep(k,W){ if(j&(1<<k)){ rep(l,H) M[l][k]^=1; } } lint maxi=0; rep(k,H) rep(l,W) if(M[k][l]) chmax(maxi,A[k][l]); ans+=maxi; } cout << ans/2 << endl;*/ /*using mint=modint998244353; mint fast_ans=0; dsu uf(H+W); lint ufcomp=H+W; vector<pair<lint,plint>> masu; rep(i,H) rep(j,W) masu.push_back({A[i][j],{i,j}}); sort(all(masu)); reverse(all(masu)); for(auto e:masu){ lint nx=e.se.fi,ny=e.se.se; lint num=e.fi; if(uf.same(nx,H+ny)) continue; uf.merge(nx,H+ny); ufcomp--; mint add=num; add*=pow_mod(2,ufcomp-1,MOD); uf.merge(nx,H+ny); fast_ans+=add; } cout << fast_ans.val() << endl;*/ }