제출 #1270189

#제출 시각아이디문제언어결과실행 시간메모리
1270189tungtungsahurTopical (NOI23_topical)C++17
12 / 100
480 ms78880 KiB
#include<bits/stdc++.h>
#define dn cout << "\n";
#define ll long long
#define F first
#define S second
#define name "task"
#define con(x) __builtin_popcount(x)
#define pb push_back
#define bit(i, j) ((i >> j) & 1)

using namespace std;
const int N = 2e5 + 2;
const int BL = 325;
const ll MOD = 1e9 + 7;

int n, k;
void solve(){
    cin >> n >> k;
    vector<int> Sat(n + 2, 0), Pos(k + 2, -1), cur;
    vector<vector<int>> p(n + 2, vector<int> (k + 2));
    vector<vector<pair<int,int>>> vec(k + 2);
    for(int i = 1; i <= n; i ++){
        for(int j = 1; j <= k; j ++){
            int x; cin >> x;
            vec[j].pb({x, i});
        }
    }
    for(int i = 1; i <= k; i ++){
        cur.pb(0);
        sort(vec[i].begin(), vec[i].end());
    }
    for(int i = 1; i <= n; i ++){
        for(int j = 1; j <= k; j ++){
            cin >> p[i][j];
        }
    }
    int dem = 0;
    while(1){
        bool used = 0;
        for(int i = 1; i <= k; i ++){
            while(Pos[i] + 1 < n && vec[i][Pos[i]+1].F <= cur[i - 1]){
                Sat[vec[i][Pos[i]+1].S] ++;
                used = 1;
                if(Sat[vec[i][Pos[i]+1].S] == k){
                    for(int j = 1; j <= k; j ++)
                        cur[j - 1] += p[vec[i][Pos[i]+1].S][j];
                    dem ++;
                }
                Pos[i] ++;
            }
        }
        if(!used) break;
    }
    cout << dem;
}

main(){
    if(fopen(name".inp","r")){
        freopen(name".inp","r",stdin);
        freopen(name".out","w",stdout);
    }
    solve();
}

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

Main.cpp:57:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   57 | main(){
      | ^~~~
Main.cpp: In function 'int main()':
Main.cpp:59:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   59 |         freopen(name".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:60:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |         freopen(name".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...