제출 #1352073

#제출 시각아이디문제언어결과실행 시간메모리
1352073nguthianmangcayBitaro the Brave (JOI19_ho_t1)C++20
0 / 100
1 ms344 KiB
#include<bits/stdc++.h>
using namespace std;
const int N=3e3+3;
const long long inf=1e18+3;
#define ll long long
#define fi first
#define se second
#define VOI void

int a[N][N];

ll cnt[4][N];

VOI jiangly(){

    int h,w;
    cin>>h>>w;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            char x;
            cin>>x;
            if(x == 'J'){
                a[i][j] = 1;
            }
            else if(x == 'O'){
                a[i][j] = 2;
            }
            else if(x = 'I'){
                a[i][j] = 3;
            }
        }
    }
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(a[i][j] == 2)cnt[2][i]++;
            if(a[i][j] == 3)cnt[3][j]++;
        }
    }
    ll ans = 0;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(a[i][j] == 1){
                ans += (cnt[3][j] * cnt[2][i]);
            }
        }
    }
    cout<<ans;

}
int main(){
    cin.tie(0)->sync_with_stdio(0);
    if(fopen("QUANSENSEI.inp","r")){
        freopen("O(0).inp","r",stdin);
    }

//    if(fopen("input.txt","r")){
//        freopen("input.txt","r",stdin);
//        freopen("output.txt","w",stdout);
//    }
    jiangly();

//    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:53:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |         freopen("O(0).inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...