답안 #841678

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
841678 2023-09-01T20:36:27 Z kwongweng Topical (NOI23_topical) C++17
100 / 100
615 ms 82552 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define fi first
#define se second

int main(){
    int n, k; cin>>n>>k;
    ll r[n][k], u[n][k];
    vector<pair<ll,int>> arr[k];
    FOR(i,0,n){
        FOR(j,0,k) cin>>r[i][j];
    }
    FOR(j,0,k){
        FOR(i,0,n) arr[j].pb({r[i][j], i});
        sort(arr[j].begin(), arr[j].end());
    }
    FOR(i,0,n){
        FOR(j,0,k) cin>>u[i][j];
    }
    vi cnt(n);
    vi bfs;
    vector<ll> p(k); vi cur(k);
    FOR(j,0,k){
        while (cur[j] < n && p[j] >= arr[j][cur[j]].fi){
            int pos = arr[j][cur[j]].se;
            cnt[pos]++;
            if (cnt[pos]==k){
                bfs.pb(pos);
            }
            cur[j]++;
        }
    }
    FOR(i,0,bfs.size()){
        //cout<<bfs[i]<<"\n";
        int ind = bfs[i];
        FOR(j,0,k){
            p[j] += u[ind][j];
            while (cur[j] < n && p[j] >= arr[j][cur[j]].fi){
                int pos = arr[j][cur[j]].se;
                cnt[pos]++;
                if (cnt[pos]==k){
                    bfs.pb(pos);
                }
                cur[j]++;
            }
        }
        
    }
    cout<<bfs.size()<<"\n";
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:10:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 | #define FOR(i, a, b) for(int i = a; i < b; i++)
......
   44 |     FOR(i,0,bfs.size()){
      |         ~~~~~~~~~~~~~~                 
Main.cpp:44:5: note: in expansion of macro 'FOR'
   44 |     FOR(i,0,bfs.size()){
      |     ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 5 ms 1116 KB Output is correct
4 Correct 447 ms 82368 KB Output is correct
5 Correct 463 ms 82368 KB Output is correct
6 Correct 456 ms 82372 KB Output is correct
7 Correct 323 ms 82552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 6 ms 860 KB Output is correct
8 Correct 10 ms 860 KB Output is correct
9 Correct 5 ms 860 KB Output is correct
10 Correct 7 ms 860 KB Output is correct
11 Correct 6 ms 860 KB Output is correct
12 Correct 8 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 6 ms 1116 KB Output is correct
4 Correct 61 ms 6428 KB Output is correct
5 Correct 51 ms 5960 KB Output is correct
6 Correct 615 ms 58488 KB Output is correct
7 Correct 552 ms 56200 KB Output is correct
8 Correct 577 ms 58636 KB Output is correct
9 Correct 538 ms 56492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 5 ms 1116 KB Output is correct
4 Correct 447 ms 82368 KB Output is correct
5 Correct 463 ms 82368 KB Output is correct
6 Correct 456 ms 82372 KB Output is correct
7 Correct 323 ms 82552 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 6 ms 860 KB Output is correct
15 Correct 10 ms 860 KB Output is correct
16 Correct 5 ms 860 KB Output is correct
17 Correct 7 ms 860 KB Output is correct
18 Correct 6 ms 860 KB Output is correct
19 Correct 8 ms 860 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 6 ms 1116 KB Output is correct
23 Correct 61 ms 6428 KB Output is correct
24 Correct 51 ms 5960 KB Output is correct
25 Correct 615 ms 58488 KB Output is correct
26 Correct 552 ms 56200 KB Output is correct
27 Correct 577 ms 58636 KB Output is correct
28 Correct 538 ms 56492 KB Output is correct
29 Correct 580 ms 54816 KB Output is correct
30 Correct 554 ms 49380 KB Output is correct
31 Correct 572 ms 47988 KB Output is correct
32 Correct 377 ms 45464 KB Output is correct
33 Correct 425 ms 42264 KB Output is correct
34 Correct 458 ms 42204 KB Output is correct
35 Correct 484 ms 44400 KB Output is correct
36 Correct 487 ms 45196 KB Output is correct
37 Correct 567 ms 48092 KB Output is correct
38 Correct 299 ms 36928 KB Output is correct