답안 #57343

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
57343 2018-07-14T15:15:59 Z dennisstar 여왕벌 (KOI15_queen) C++11
34 / 100
5000 ms 18148 KB
#include <bits/stdc++.h>
int M, N;
char c[710][710][3][3][3];
int sum[710][710];
int main()
{
	int i, j, k;
	scanf("%d %d", &M, &N);
	for (i=1; i<M; i++) for (j=1; j<M; j++) for (k=0; k<27; k++) scanf(" %c", &c[i][j][k/9][(k%9)/3][k%3]);
	int x, y, z;
	for (i=1; i<M; i++) for (j=1; j<M; j++) for (x=0; x<3; x++) for (y=0; y<3; y++)
		for (z=0; z<3; z++) {
			if (c[i][j][x][y][z]=='L') c[i][j][x][y][z]=x;
			else if (c[i][j][x][y][z]=='D') c[i][j][x][y][z]=y;
			else c[i][j][x][y][z]=z;
		}
	int l, r, lp, rp;

	for (i=0; i<N; i++) {
		scanf("%d %d %d", &x, &y, &z);
		l=(x<M?0:(x-M+1));
		r=((x+y)<M?0:(x+y-M+1));
		sum[0][l]++, sum[0][r]++;
		for (j=1; j<M; j++) {
			if (x+j==M)l++;
			if (x+y+j==M)r++;
			if (l&&l!=r&&l<M) {
				if(c[j][l][0][x+j==M?1:0][1]==0) {
					l++;
					while(c[j][l][0][1][1]==0&&l<r) l++;
				}
			}
			if (r&&r<M) {
				if (l==r&&c[j][l][0][1][2]==1){
					r++;
					while(c[j][r][1][2][2]==1&&r<M) r++;
				}
				else if (l==r) {
					if (c[j][r][0][1][2]==0) {
						r++;
						while(c[j][r][0][2][2]==0&&r<M) r++;
						l=r;
					}
				}
				else {
					if (r==1) while(c[j][r][1][2][2]==1&&r<M)r++;
					else if (c[j][r][1][1][2]==1) {
						r++;
						while(c[j][r][1][2][2]==1&&r<M) r++;
					}
				}
			}
			sum[j][l]++, sum[j][r]++;
		}
	}
	for (i=0; i<M; i++) {
		for (j=1; j<M; j++) {
			sum[i][j]+=sum[i][j-1];
		}
	}
	for (i=0; i<M; i++) {
		for (j=0; j<M; j++) {
			printf("%d ", sum[i][j]+1);
		}
		puts("");
	}
	return 0;
}

Compilation message

queen.cpp: In function 'int main()':
queen.cpp:17:12: warning: unused variable 'lp' [-Wunused-variable]
  int l, r, lp, rp;
            ^~
queen.cpp:17:16: warning: unused variable 'rp' [-Wunused-variable]
  int l, r, lp, rp;
                ^~
queen.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &M, &N);
  ~~~~~^~~~~~~~~~~~~~~~~
queen.cpp:9:68: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (i=1; i<M; i++) for (j=1; j<M; j++) for (k=0; k<27; k++) scanf(" %c", &c[i][j][k/9][(k%9)/3][k%3]);
                                                               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
queen.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d", &x, &y, &z);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 33 ms 1328 KB Output is correct
4 Correct 26 ms 1440 KB Output is correct
5 Correct 218 ms 5320 KB Output is correct
6 Correct 225 ms 5320 KB Output is correct
7 Correct 197 ms 5320 KB Output is correct
8 Correct 750 ms 11116 KB Output is correct
9 Correct 584 ms 11256 KB Output is correct
10 Correct 1012 ms 16744 KB Output is correct
11 Correct 997 ms 16744 KB Output is correct
12 Correct 1027 ms 16744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 16744 KB Output is correct
2 Correct 237 ms 16744 KB Output is correct
3 Correct 457 ms 16744 KB Output is correct
4 Correct 1194 ms 18148 KB Output is correct
5 Correct 1240 ms 18148 KB Output is correct
6 Correct 1138 ms 18148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 18148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5006 ms 18148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 18148 KB Output isn't correct
2 Halted 0 ms 0 KB -