제출 #1286429

#제출 시각아이디문제언어결과실행 시간메모리
1286429lucianTopical (NOI23_topical)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n, k;
	cin >> n >> k;
	int r[n + 1][k + 1];
	int u[n + 1][k + 1];
	int p[k + 1] = {0};
	bool done[n + 1] = {false};
	int id[n + 1];

	for(int i = 0; i < n; i++){
		for(int j = 0; j < k; j++){
			cin >> r[i][j];
		}
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < k; j++){
			cin >> u[i][j];
		}
	}

	for(int i = 0; i < n; i++) id[i] = i;

	auto cmp = [&](int a, int b){
		long long sa = 0, sb = 0;
		for(int j = 0; j < k; j++){
			sa += r[a][j];
			sb += r[b][j];
		}
		return sa < sb;
	};

	sort(id, id + n, cmp);

	int completed = 0;
	bool progress = true;
	while(progress){
		progress = false;
		for(int ii = 0; ii < n; ii++){
			int i = id[ii];
			if(done[i]) continue;
			bool can = true;
			for(int j = 0; j < k; j++){
				if(p[j] < r[i][j]){
					can = false;
					break;
				}
			}
			if(can){
				done[i] = true;
				completed++;
				progress = true;
				for(int j = 0; j < k; j++){
					p[j] += u[i][j];
					if(p[j] > 1000000000){
						p[j] = 1000000000;
					}
				}
			}
		}
	}

	cout << completed;
}
  

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In lambda function:
Main.cpp:33:31: sorry, unimplemented: capture of variably-modified type 'int [(n + 1)][(k + 1)]' that is not an N3639 array of runtime bound
   33 |                         sa += r[a][j];
      |                               ^
Main.cpp:33:31: note: because the array element type 'int [(k + 1)]' has variable size
Main.cpp:34:31: sorry, unimplemented: capture of variably-modified type 'int [(n + 1)][(k + 1)]' that is not an N3639 array of runtime bound
   34 |                         sb += r[b][j];
      |                               ^
Main.cpp:34:31: note: because the array element type 'int [(k + 1)]' has variable size