Submission #102483

# Submission time Handle Problem Language Result Execution time Memory
102483 2019-03-25T09:24:44 Z AKaan37 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
707 ms 155272 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 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 6 ms 1664 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 5 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 1664 KB Output is correct
12 Correct 4 ms 1536 KB Output is correct
13 Correct 4 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 6 ms 1664 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 5 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 1664 KB Output is correct
12 Correct 4 ms 1536 KB Output is correct
13 Correct 4 ms 1536 KB Output is correct
14 Correct 23 ms 8932 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 17 ms 5240 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 27 ms 9984 KB Output is correct
19 Correct 23 ms 9724 KB Output is correct
20 Correct 30 ms 9720 KB Output is correct
21 Correct 24 ms 9984 KB Output is correct
22 Correct 25 ms 9856 KB Output is correct
23 Correct 27 ms 9720 KB Output is correct
24 Correct 27 ms 9848 KB Output is correct
25 Correct 23 ms 9720 KB Output is correct
26 Correct 23 ms 9728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 6 ms 1664 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 5 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 1664 KB Output is correct
12 Correct 4 ms 1536 KB Output is correct
13 Correct 4 ms 1536 KB Output is correct
14 Correct 23 ms 8932 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 17 ms 5240 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 27 ms 9984 KB Output is correct
19 Correct 23 ms 9724 KB Output is correct
20 Correct 30 ms 9720 KB Output is correct
21 Correct 24 ms 9984 KB Output is correct
22 Correct 25 ms 9856 KB Output is correct
23 Correct 27 ms 9720 KB Output is correct
24 Correct 27 ms 9848 KB Output is correct
25 Correct 23 ms 9720 KB Output is correct
26 Correct 23 ms 9728 KB Output is correct
27 Correct 652 ms 155272 KB Output is correct
28 Correct 29 ms 26368 KB Output is correct
29 Correct 52 ms 13816 KB Output is correct
30 Correct 4 ms 828 KB Output is correct
31 Correct 612 ms 129928 KB Output is correct
32 Correct 603 ms 154668 KB Output is correct
33 Correct 661 ms 154104 KB Output is correct
34 Correct 603 ms 149752 KB Output is correct
35 Correct 684 ms 154616 KB Output is correct
36 Correct 647 ms 154232 KB Output is correct
37 Correct 707 ms 154928 KB Output is correct
38 Correct 419 ms 129144 KB Output is correct
39 Correct 466 ms 129152 KB Output is correct