Submission #72575037
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define vvii vector<vector<pair<int,int>>>
#define vvll vector<vector<pair<ll,ll>>>
#define vst vector<string>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define mkunique(x) sort(all(x));(x).erase(unique(all(x)),(x).end())
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=3005,INF=15<<26;
ll E[MAX][MAX],F[MAX][MAX],G[MAX][MAX];
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
ll H,W;cin>>H>>W;
vst S(H);
for(int i=0;i<H;i++){
cin>>S[i];
}
for(int h=0;h<H;h++){
for(int w=0;w<W;w++){
F[h][w+1]=F[h][w];
if(S[h][w]=='F') F[h][w+1]++;
G[h+1][w]+=G[h][w];
if(S[h][w]=='G') G[h+1][w]++;
}
}
for(int h=0;h<H;h++){
for(int w=0;w<W;w++){
if(S[h][w]=='E') E[h][w]=1;
if(w) E[h][w]+=E[h][w-1];
}
}
for(int w=0;w<W;w++){
for(int h=1;h<H;h++) E[h][w]+=E[h-1][w];
}
ll ans=0;
for(int h=1;h<H;h++){
for(int w=1;w<W;w++){
ans+=(F[h][W]-F[h][w+1])*(G[H][w]-G[h+1][w])*(E[h-1][w-1]);
//cout<<ans<<endl;
}
}
cout<<ans<<endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | G - EGFグリッド |
| User | guild2026_099 |
| Language | C++ IOI-Style(GNU++20) (GCC 14.2.0) |
| Score | 100 |
| Code Size | 1850 Byte |
| Status | AC |
| Exec Time | 134 ms |
| Memory | 123688 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 1704 KiB |
| 00_sample_01.txt | AC | 0 ms | 1704 KiB |
| 00_sample_02.txt | AC | 0 ms | 1832 KiB |
| 01_random_00.txt | AC | 45 ms | 47272 KiB |
| 01_random_01.txt | AC | 25 ms | 35496 KiB |
| 01_random_02.txt | AC | 48 ms | 46632 KiB |
| 01_random_03.txt | AC | 132 ms | 123688 KiB |
| 01_random_04.txt | AC | 56 ms | 55336 KiB |
| 01_random_05.txt | AC | 83 ms | 83240 KiB |
| 01_random_06.txt | AC | 102 ms | 95400 KiB |
| 01_random_07.txt | AC | 134 ms | 123688 KiB |
| 01_random_08.txt | AC | 23 ms | 30248 KiB |
| 01_random_09.txt | AC | 98 ms | 94888 KiB |
| 01_random_10.txt | AC | 3 ms | 4392 KiB |
| 01_random_11.txt | AC | 37 ms | 47016 KiB |
| 01_random_12.txt | AC | 40 ms | 40104 KiB |
| 01_random_13.txt | AC | 125 ms | 123688 KiB |
| 01_random_14.txt | AC | 68 ms | 68776 KiB |
| 01_random_15.txt | AC | 43 ms | 50088 KiB |
| 01_random_16.txt | AC | 115 ms | 123688 KiB |
| 01_random_17.txt | AC | 116 ms | 123560 KiB |
| 01_random_18.txt | AC | 114 ms | 123560 KiB |
| 01_random_19.txt | AC | 117 ms | 123688 KiB |