Submission #123989

# Submission time Handle Problem Language Result Execution time Memory
123989 2019-07-02T10:30:02 Z ioilolcom Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
1000 ms 99196 KB
#include <bits/stdc++.h>
using namespace std;
 
const int MAXN = 3100;
int N,M;
long long ans;
int matriz[MAXN][MAXN];
int row[MAXN][MAXN], r;
int column[MAXN][MAXN], c;
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') matriz[i][j]=-1;
            if(letra=='I') matriz[i][j]=1;
            if(letra=='O') column[i][j]+=++c;
            else column[i][j]=c;
        }
        c=0;
    }
 
    for(int i=1; i<=M; i++){
        for(int j=1; j<=N; j++){
            if(matriz[j][i]==1) row[j][i]+=++r;
            else row[j][i]=r;
        }
        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=1; i<=N; i++)
        for(int j=1; j<=M; j++)
            if(matriz[i][j]==-1) ans+= (column[i][M]-column[i][j])*(row[N][j]-row[i][j]);
 
    printf("%lld", ans);
    return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:15: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 time Memory Grader output
1 Correct 2 ms 396 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 4 ms 1656 KB Output is correct
6 Correct 4 ms 1648 KB Output is correct
7 Correct 4 ms 1528 KB Output is correct
8 Correct 4 ms 1684 KB Output is correct
9 Correct 4 ms 1676 KB Output is correct
10 Correct 4 ms 1528 KB Output is correct
11 Correct 4 ms 1688 KB Output is correct
12 Correct 4 ms 1656 KB Output is correct
13 Correct 4 ms 1528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 396 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 4 ms 1656 KB Output is correct
6 Correct 4 ms 1648 KB Output is correct
7 Correct 4 ms 1528 KB Output is correct
8 Correct 4 ms 1684 KB Output is correct
9 Correct 4 ms 1676 KB Output is correct
10 Correct 4 ms 1528 KB Output is correct
11 Correct 4 ms 1688 KB Output is correct
12 Correct 4 ms 1656 KB Output is correct
13 Correct 4 ms 1528 KB Output is correct
14 Correct 31 ms 8820 KB Output is correct
15 Correct 6 ms 5496 KB Output is correct
16 Correct 19 ms 5048 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 38 ms 9592 KB Output is correct
19 Correct 36 ms 9208 KB Output is correct
20 Correct 34 ms 9096 KB Output is correct
21 Correct 39 ms 9588 KB Output is correct
22 Correct 34 ms 9332 KB Output is correct
23 Correct 35 ms 9076 KB Output is correct
24 Correct 38 ms 9636 KB Output is correct
25 Correct 34 ms 9084 KB Output is correct
26 Correct 34 ms 9052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 396 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 4 ms 1656 KB Output is correct
6 Correct 4 ms 1648 KB Output is correct
7 Correct 4 ms 1528 KB Output is correct
8 Correct 4 ms 1684 KB Output is correct
9 Correct 4 ms 1676 KB Output is correct
10 Correct 4 ms 1528 KB Output is correct
11 Correct 4 ms 1688 KB Output is correct
12 Correct 4 ms 1656 KB Output is correct
13 Correct 4 ms 1528 KB Output is correct
14 Correct 31 ms 8820 KB Output is correct
15 Correct 6 ms 5496 KB Output is correct
16 Correct 19 ms 5048 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 38 ms 9592 KB Output is correct
19 Correct 36 ms 9208 KB Output is correct
20 Correct 34 ms 9096 KB Output is correct
21 Correct 39 ms 9588 KB Output is correct
22 Correct 34 ms 9332 KB Output is correct
23 Correct 35 ms 9076 KB Output is correct
24 Correct 38 ms 9636 KB Output is correct
25 Correct 34 ms 9084 KB Output is correct
26 Correct 34 ms 9052 KB Output is correct
27 Execution timed out 1080 ms 99196 KB Time limit exceeded
28 Halted 0 ms 0 KB -