답안 #393249

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
393249 2021-04-23T04:53:35 Z anime 벽 칠하기 (APIO20_paint) C++14
컴파일 오류
0 ms 0 KB
#include "grader.cpp"
#include "paint.h"
#include <bits/stdc++.h>
#define pb push_back
#define pii pair<int,int>
#define fr first
#define sc second
#define OK puts("OK");
#define endi puts("");
#define ret return
#define all(s) s.begin(),s.end()
using namespace std;
const int N = 1e5+5,INF = 1e9+7;
vector <int> v[N],c;
int n,m,k;
bitset <2000> can[N];
int p[N],dp[20000][2000];

bool is(int l,int r){
	int i,x = r-l+1;
	for (i=0;i<m;++i){
		if (l == 0){
			if (dp[r][i] == x)ret 1;
		}
		else {
			int y = dp[r][i]-dp[l-1][i];
			if (y == x)ret 1;
		}
	}
	ret 0;
}

int minimumInstructions(int N, int M, int K,vector<int> C,vector<int> A, vector<vector<int>> B){
	c = C;n=N;m=M;k=K;
	
    int i,j,ans=0;
    for (i=0;i<m;++i)
        for (int x: B[i])
			can[x][i] = 1;
	
	for (i=0;i<n;++i){
		if (i > 0)
			for (j=0;j<m;++j){
				int x = j-1;
				x+=m;
				x%=m;
				dp[i][j] = dp[i-1][x];
			}
		for (j=0;j<m;++j)
			if (can[c[i]][j] == 1)
				dp[i][j]++;
	}
	for (i=0;i<n-m+1;++i)
		p[i] = is(i,i+m-1);
	int pos = 0,z=1;
	while (pos >= 0 && pos < n && z>0){
		if (p[pos] == 1){
			pos +=m;
			ans++;
			z= m;
		}
		else {
			pos--;
			z--;
		}
	}
	if (pos < n)ans= -1;
	ret ans;


}





Compilation message

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:37:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   37 |     for (i=0;i<m;++i)
      |     ^~~
paint.cpp:41:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   41 |  for (i=0;i<n;++i){
      |  ^~~
/tmp/cchYcDTh.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccMcZtfU.o:paint.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status