Submission #988

#TimeUsernameProblemLanguageResultExecution timeMemory
988testtest파일 삭제 (GA3_delete)C++98
Compilation error
0 ms0 KiB
#include <vector> #include <algorithm> using namespace std; const int SZ = 1005; const int INF = 987654321; vector<int> Gph[SZ]; vector<int> Que; int Table[SZ][SZ], Tmp[SZ]; int Parent[SZ], Size[SZ]; int DeletePlan( int N, int M, int K, int *A, int *B) { int i, j, k; for(i = 0; i < N; i++) Gph[ A[i] ].push_back(i + M); for(i = 1; i < M; i++) Gph[ B[i] ].push_back(i); int fr = 0, i; Que.push_back(0); while(fr < Que.size()){ int n = Que[fr++]; for(i = 0; i < Gph[n].size(); i++) { int g = Gph[n][i]; Que.push_back(g); Parent[g] = n; } } for(i = 0; i < N + M; i++) { Table[i][1] = 1; if(i >= M) Size[i] = 1; for(j = 2; j <= N; j++) Table[i][j] = INF; } for(i = (int)Que.size() - 1; i > 0; i--){ int n = Que[i], p = Parent[n]; Size[p] += Size[n]; Table[n][Size[n]] = 1; for(j = 1; j <= Size[p]; j++) Tmp[j] = Table[p][j]; for(j = 1; j <= Size[p]; j++){ for(k = j; k <= Size[p]; k++) Table[p][k] = min(Table[p][k], Tmp[k - j] + Table[n][j]); } } int ret = INF; for(i = 0; i < N + M; i++) ret = min(ret, Table[i][K]); return ret; }

Compilation message (stderr)

grader.cpp:30:2: warning: no newline at end of file
delete.cpp: In function 'int DeletePlan(int, int, int, int*, int*)':
delete.cpp:19: error: redeclaration of 'int i'
delete.cpp:14: error: 'int i' previously declared here
delete.cpp:20: warning: comparison between signed and unsigned integer expressions
delete.cpp:22: warning: comparison between signed and unsigned integer expressions