답안 #1016653

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1016653 2024-07-08T09:57:03 Z Salty Topical (NOI23_topical) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#define ll long long 
#define st first
#define nd second 
#define pii pair<int,int>
using namespace std;
int main(){
    int n,k;
    cin >> n >> k;
    vector<vector<int>> u(n,vector<int>(k)),r(n,vector<int>(k));
    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];
    vector<int> cur (k,0), cntcol(k,0), cntrow(n,0), use(n,0);
    vector<pii> vec[k];
    queue<int> q;
    int ans = 0;
    for(int i = 0; i < n; i++){
        bool can = true;
        for(int j = 0; j < k; j++){
            if(r[i][j] > 0) can = false;
            vec[j].push_back({r[i][j],i});
        }
        if(can){
            q.push(i);
            use[i] = 1;
        }
    }
    for(int i = 0; i < k; i++)sort(vec[i].begin(),vec[i].end());
    while(!q.empty()){
        int fr = q.front();
        ans++;
        q.pop();
        for(int i = 0; i < k; i++){
            cur[i] += u[fr][i];
            while(cntcol[i] < n && vec[i][cntcol[i]].st <= cur[i]){
                cntrow[vec[i][cntcol[i]].nd]++;
                if(cntrow[vec[i][cntcol[i]].nd] == k && !use[vec[i][cntcol[i]].nd]){
                    q.push(vec[i][cntcol[i]].nd);
                    use[vec[i][cntcol[i]].nd] = 1;
                }
                cntcol[i]++;
            }
        }
    }
    cout << ans;
   

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:45:16: error: expected '}' at end of input
   45 |     cout << ans;
      |                ^
Main.cpp:7:11: note: to match this '{'
    7 | int main(){
      |           ^