Submission #228168

# Submission time Handle Problem Language Result Execution time Memory
228168 2020-04-30T05:44:13 Z blacktulip Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
723 ms 159128 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 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 6 ms 1536 KB Output is correct
6 Correct 7 ms 1536 KB Output is correct
7 Correct 7 ms 1536 KB Output is correct
8 Correct 6 ms 1664 KB Output is correct
9 Correct 6 ms 1536 KB Output is correct
10 Correct 6 ms 1536 KB Output is correct
11 Correct 6 ms 1536 KB Output is correct
12 Correct 6 ms 1536 KB Output is correct
13 Correct 6 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 6 ms 1536 KB Output is correct
6 Correct 7 ms 1536 KB Output is correct
7 Correct 7 ms 1536 KB Output is correct
8 Correct 6 ms 1664 KB Output is correct
9 Correct 6 ms 1536 KB Output is correct
10 Correct 6 ms 1536 KB Output is correct
11 Correct 6 ms 1536 KB Output is correct
12 Correct 6 ms 1536 KB Output is correct
13 Correct 6 ms 1536 KB Output is correct
14 Correct 29 ms 9080 KB Output is correct
15 Correct 7 ms 5120 KB Output is correct
16 Correct 16 ms 5376 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 29 ms 9984 KB Output is correct
19 Correct 25 ms 9856 KB Output is correct
20 Correct 33 ms 9772 KB Output is correct
21 Correct 26 ms 9984 KB Output is correct
22 Correct 26 ms 9856 KB Output is correct
23 Correct 25 ms 9856 KB Output is correct
24 Correct 26 ms 9984 KB Output is correct
25 Correct 25 ms 9856 KB Output is correct
26 Correct 25 ms 9856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 6 ms 1536 KB Output is correct
6 Correct 7 ms 1536 KB Output is correct
7 Correct 7 ms 1536 KB Output is correct
8 Correct 6 ms 1664 KB Output is correct
9 Correct 6 ms 1536 KB Output is correct
10 Correct 6 ms 1536 KB Output is correct
11 Correct 6 ms 1536 KB Output is correct
12 Correct 6 ms 1536 KB Output is correct
13 Correct 6 ms 1536 KB Output is correct
14 Correct 29 ms 9080 KB Output is correct
15 Correct 7 ms 5120 KB Output is correct
16 Correct 16 ms 5376 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 29 ms 9984 KB Output is correct
19 Correct 25 ms 9856 KB Output is correct
20 Correct 33 ms 9772 KB Output is correct
21 Correct 26 ms 9984 KB Output is correct
22 Correct 26 ms 9856 KB Output is correct
23 Correct 25 ms 9856 KB Output is correct
24 Correct 26 ms 9984 KB Output is correct
25 Correct 25 ms 9856 KB Output is correct
26 Correct 25 ms 9856 KB Output is correct
27 Correct 669 ms 158712 KB Output is correct
28 Correct 20 ms 26368 KB Output is correct
29 Correct 58 ms 13992 KB Output is correct
30 Correct 6 ms 768 KB Output is correct
31 Correct 540 ms 131448 KB Output is correct
32 Correct 655 ms 159064 KB Output is correct
33 Correct 639 ms 158544 KB Output is correct
34 Correct 584 ms 152440 KB Output is correct
35 Correct 661 ms 158964 KB Output is correct
36 Correct 651 ms 158584 KB Output is correct
37 Correct 723 ms 159128 KB Output is correct
38 Correct 474 ms 130808 KB Output is correct
39 Correct 448 ms 130936 KB Output is correct