Submission #717577

# Submission time Handle Problem Language Result Execution time Memory
717577 2023-04-02T08:29:52 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long int
char grid[501][501];
int findingnemo(int x,int y){
	int ans=0;
	for(int a=1;a<=x;a++){
		for(int b=1;b<=y;b++){
			ans++;
		}
	}
	return ans;
}
int32_t main(){
	int h,w,jx,jy,counto=0,counti=0,ans;
	cin >> h >> w;
	for(int x=0;x<h;x++){
		for(int y=0;y<w;y++){
			cin >> grid[x][y];
		}
	}
	for(int x=0;x<h;x++){
		for(int y=0;y<w;y++){
			counto=0;
			counti=0;
			if(grid[x][y]=='J'){
				for(int j=0;j<w;j++){
					if(grid[x][j]=='O'){
						if(y<j) counto++;
					}
				}
				for(int i=0;i<h;i++){
					if(grid[i][y]=='I'){
						if(x<i) counti++;
					}
				}
				if((counto>=1)&&(counti>=1)) ans = ans + findingnemo(counto,counti);
			}
		}
	}
	cout << ans;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int32_t main()':
joi2019_ho_t1.cpp:15:10: warning: unused variable 'jx' [-Wunused-variable]
   15 |  int h,w,jx,jy,counto=0,counti=0,ans;
      |          ^~
joi2019_ho_t1.cpp:15:13: warning: unused variable 'jy' [-Wunused-variable]
   15 |  int h,w,jx,jy,counto=0,counti=0,ans;
      |             ^~
joi2019_ho_t1.cpp:37:38: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   37 |     if((counto>=1)&&(counti>=1)) ans = ans + findingnemo(counto,counti);
      |                                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -