Submission #97796

# Submission time Handle Problem Language Result Execution time Memory
97796 2019-02-18T14:12:01 Z AKaan37 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
849 ms 150436 KB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int lo;
typedef pair< int,int > PII;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(lo i=1;i<=n;i++)
 
const int inf = 1000000000;
const int mod = 1000000007;
const int KOK = 100000;
const int li = 100005;
const int LOG = 20;
 
lo n,m,cev,x,k,O[3005][3005],I[3005][3005];
vector<int> v;
char c[3005][3005];
string s;
 
int main(){
	scanf("%lld %lld",&n,&m);
	FOR{
		for(lo j=1;j<=m;j++){
			scanf(" %c",&c[i][j]);
			if(c[i][j]=='O') O[i][j]=O[i][j-1]+1;
			if(c[i][j]!='O') O[i][j]=O[i][j-1];
			if(c[i][j]=='I') I[i][j]=I[i-1][j]+1;
			if(c[i][j]!='I') I[i][j]=I[i-1][j];
		}
	}
	FOR{
		for(lo j=1;j<=m;j++){
			//~ cout<<O[i][m]-O[i][j]<<" ";
			if(c[i][j]=='J') cev+=(O[i][m]-O[i][j])*(I[n][j]-I[i][j]);
			//~ if(c[i][j]=='J') cev+=I[j];
		}
		//~ cout<<endl;
	}
	printf("%lld\n",cev);
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:27:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:30:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c",&c[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 5 ms 1536 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 4 ms 1664 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1536 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 5 ms 1536 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 4 ms 1664 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1536 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1536 KB Output is correct
14 Correct 23 ms 8832 KB Output is correct
15 Correct 7 ms 4992 KB Output is correct
16 Correct 18 ms 5240 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 32 ms 9724 KB Output is correct
19 Correct 36 ms 9592 KB Output is correct
20 Correct 25 ms 9600 KB Output is correct
21 Correct 37 ms 9720 KB Output is correct
22 Correct 26 ms 9600 KB Output is correct
23 Correct 37 ms 9592 KB Output is correct
24 Correct 28 ms 9720 KB Output is correct
25 Correct 26 ms 9600 KB Output is correct
26 Correct 33 ms 9592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 5 ms 1536 KB Output is correct
6 Correct 5 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 4 ms 1664 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1536 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 5 ms 1536 KB Output is correct
14 Correct 23 ms 8832 KB Output is correct
15 Correct 7 ms 4992 KB Output is correct
16 Correct 18 ms 5240 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 32 ms 9724 KB Output is correct
19 Correct 36 ms 9592 KB Output is correct
20 Correct 25 ms 9600 KB Output is correct
21 Correct 37 ms 9720 KB Output is correct
22 Correct 26 ms 9600 KB Output is correct
23 Correct 37 ms 9592 KB Output is correct
24 Correct 28 ms 9720 KB Output is correct
25 Correct 26 ms 9600 KB Output is correct
26 Correct 33 ms 9592 KB Output is correct
27 Correct 731 ms 150436 KB Output is correct
28 Correct 29 ms 26368 KB Output is correct
29 Correct 51 ms 13468 KB Output is correct
30 Correct 5 ms 768 KB Output is correct
31 Correct 493 ms 125304 KB Output is correct
32 Correct 670 ms 150356 KB Output is correct
33 Correct 742 ms 149864 KB Output is correct
34 Correct 676 ms 145400 KB Output is correct
35 Correct 692 ms 150404 KB Output is correct
36 Correct 621 ms 149740 KB Output is correct
37 Correct 849 ms 150352 KB Output is correct
38 Correct 525 ms 124696 KB Output is correct
39 Correct 469 ms 124920 KB Output is correct