제출 #110682

#제출 시각아이디문제언어결과실행 시간메모리
110682Breno_XDBitaro the Brave (JOI19_ho_t1)C++14
50 / 100
1069 ms135332 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 3200; int N,M; long long ans; int matriz[MAXN][MAXN]; int row[MAXN][MAXN], r; int column[MAXN][MAXN], c; vector<pair<int,int> > calcula; char letra; int main(){ //Leitura scanf("%d%d", &N, &M); for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ cin >> letra; if(letra=='J') calcula.push_back({i,j}); if(letra=='I') matriz[i][j]=1; if(letra=='O') column[i][j]+=++c; else column[i][j]=c; } c=0; } for(int i=0; i<=M; i++){ for(int j=N; j>=1; j--){ if(matriz[j][i]==1) row[j][i]+=++r; else row[j][i]=r; column[j][i] = column[j][M]-column[j][i]; } r=0; } /* cout << endl; for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ cout << matriz[i][j] << " "; } cout << endl; } cout << endl; cout << endl; for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ cout << row[i][j] << " "; } cout << endl; } cout << endl; cout << endl; for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ cout << column[i][j] << " "; } cout << endl; } cout << endl; */ for(int i=0; i<calcula.size(); i++){ int k = calcula[i].first, l = calcula[i].second; ans+=column[k][l]*row[k][l]; } /* for(int i=1; i<=N; i++) for(int j=1; j<=M; j++) if(matriz[i][j]==-1) ans+= column[i][j]*row[i][j]; */ printf("%lld", ans); return 0; }

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

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:66:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<calcula.size(); i++){
                  ~^~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &M);
     ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...