Submission #102483

#TimeUsernameProblemLanguageResultExecution timeMemory
102483AKaan37Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
707 ms155272 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...