Submission #994707
Source Code Expand
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using namespace std; template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";} template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;} int H,W; string s[200]; typedef long long ll; ll mod=1e9+7; int calc2(string s){ string t=s; reverse(all(t)); if(s==t) return 1; return 2; } int f[5]={1,1,2,6,24}; int calc(string s){ map<char,int> mp; rep(i,4) mp[s[i]]++; int ret=24; for(auto it:mp){ ret/=f[it.sc]; } // show(s); // show(ret); return ret; } int main(){ cin>>H>>W; rep(i,H) cin>>s[i]; ll ans=1; rep(i,H/2) rep(j,W/2){ string t; t+=s[i][j]; t+=s[i][W-1-j]; t+=s[H-1-i][j]; t+=s[H-1-i][W-1-j]; ans=ans*calc(t)%mod; } if(H%2){ string t=s[H/2]; ans=ans*calc2(t)%mod; } if(W%2){ string t; rep(i,H) t+=s[i][W/2]; ans=ans*calc2(t)%mod; } cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | I - Reverse Grid |
User | sigma425 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1320 Byte |
Status | WA |
Exec Time | 8 ms |
Memory | 384 KB |
Judge Result
Set Name | sample | all | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1900 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
all | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 2 ms | 256 KB |
01-02.txt | AC | 2 ms | 256 KB |
01-03.txt | AC | 2 ms | 256 KB |
01-04.txt | AC | 2 ms | 256 KB |
01-05.txt | AC | 2 ms | 256 KB |
01-06.txt | AC | 2 ms | 256 KB |
01-07.txt | AC | 2 ms | 384 KB |
01-08.txt | AC | 3 ms | 256 KB |
01-09.txt | AC | 3 ms | 256 KB |
01-10.txt | AC | 6 ms | 256 KB |
01-11.txt | AC | 7 ms | 256 KB |
01-12.txt | AC | 7 ms | 384 KB |
01-13.txt | AC | 7 ms | 256 KB |
01-14.txt | WA | 4 ms | 256 KB |
01-15.txt | WA | 4 ms | 256 KB |
01-16.txt | WA | 8 ms | 256 KB |
01-17.txt | WA | 8 ms | 256 KB |
01-18.txt | WA | 8 ms | 256 KB |
01-19.txt | WA | 8 ms | 256 KB |
01-20.txt | WA | 8 ms | 256 KB |
01-21.txt | WA | 8 ms | 256 KB |
01-22.txt | WA | 2 ms | 256 KB |
01-23.txt | WA | 5 ms | 256 KB |
01-24.txt | WA | 8 ms | 256 KB |
01-25.txt | WA | 8 ms | 256 KB |
01-26.txt | WA | 8 ms | 256 KB |
01-27.txt | WA | 3 ms | 256 KB |
01-28.txt | WA | 3 ms | 256 KB |
01-29.txt | AC | 2 ms | 256 KB |
01-30.txt | WA | 4 ms | 256 KB |
01-31.txt | WA | 8 ms | 256 KB |
01-32.txt | WA | 8 ms | 256 KB |
01-33.txt | WA | 8 ms | 256 KB |
01-34.txt | WA | 8 ms | 256 KB |
01-35.txt | WA | 8 ms | 256 KB |
sample-01.txt | AC | 2 ms | 256 KB |
sample-02.txt | AC | 2 ms | 256 KB |