제출 #1328528

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

const int MOD = 1e9 + 7;

int n, k, ans = 0;
vector<pair<int, int>>top;
vector<vector<int>>r, u;
int cnt, p, pnt;



bool until(){
	bool b = false;
	for(int i = 1; i <= k; i++){
		while(pnt[i] < top[i].size() and p[i] >= top[i][pnt[i]].first){
			int id = top[i][pnt[i]].second;
			cnt[id]++;
			if(cnt[id] == k){
				for(int j = 1; j <= k; j++){
					p[j] += u[id][j];
				}
				ans++;
				b = true;
			}
			pnt[i]++;
		}
	}
	return b;
}

signed main(){
	cin >> n >> k;
	top.resize(n + 1);
	r.resize(n + 1, vector<int>(k + 1));
	u.resize(n + 1, vector<int>(k + 1));
	cnt.resize(n + 1);
	p.resize(n + 1);
	pnt.resize(n + 1);
	for(int i = 1; i <=n; i++){
		for(int j = 1; j <= k; j++){
			cin >> r[i][j];
			top[j].push_back({r[i][j], i});
		}
	}
	
	for(int i = 1; i <= k; i++){
		sort(top[i].begin(), top[i].end());
	}
	
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= k; j++){
			cin >> u[i][j];
		}
	}
	
	while(until());
		
	cout << ans;
	
}

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

Main.cpp: In function 'bool until()':
Main.cpp:17:26: error: invalid types 'long long int[long long int]' for array subscript
   17 |                 while(pnt[i] < top[i].size() and p[i] >= top[i][pnt[i]].first){
      |                          ^
Main.cpp:17:39: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   17 |                 while(pnt[i] < top[i].size() and p[i] >= top[i][pnt[i]].first){
      |                                       ^~~~
Main.cpp:17:51: error: invalid types 'long long int[long long int]' for array subscript
   17 |                 while(pnt[i] < top[i].size() and p[i] >= top[i][pnt[i]].first){
      |                                                   ^
Main.cpp:17:68: error: invalid types 'long long int[long long int]' for array subscript
   17 |                 while(pnt[i] < top[i].size() and p[i] >= top[i][pnt[i]].first){
      |                                                                    ^
Main.cpp:18:44: error: invalid types 'long long int[long long int]' for array subscript
   18 |                         int id = top[i][pnt[i]].second;
      |                                            ^
Main.cpp:19:28: error: invalid types 'long long int[long long int]' for array subscript
   19 |                         cnt[id]++;
      |                            ^
Main.cpp:20:31: error: invalid types 'long long int[long long int]' for array subscript
   20 |                         if(cnt[id] == k){
      |                               ^
Main.cpp:22:42: error: invalid types 'long long int[long long int]' for array subscript
   22 |                                         p[j] += u[id][j];
      |                                          ^
Main.cpp:27:28: error: invalid types 'long long int[long long int]' for array subscript
   27 |                         pnt[i]++;
      |                            ^
Main.cpp: In function 'int main()':
Main.cpp:38:13: error: request for member 'resize' in 'cnt', which is of non-class type 'long long int'
   38 |         cnt.resize(n + 1);
      |             ^~~~~~
Main.cpp:39:11: error: request for member 'resize' in 'p', which is of non-class type 'long long int'
   39 |         p.resize(n + 1);
      |           ^~~~~~
Main.cpp:40:13: error: request for member 'resize' in 'pnt', which is of non-class type 'long long int'
   40 |         pnt.resize(n + 1);
      |             ^~~~~~
Main.cpp:44:32: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   44 |                         top[j].push_back({r[i][j], i});
      |                                ^~~~~~~~~
Main.cpp:49:29: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'begin'
   49 |                 sort(top[i].begin(), top[i].end());
      |                             ^~~~~
Main.cpp:49:45: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'end'
   49 |                 sort(top[i].begin(), top[i].end());
      |                                             ^~~