답안 #929227

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
929227 2024-02-18T03:25:25 Z Batorgil952 Topical (NOI23_topical) C++14
100 / 100
549 ms 111784 KB
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

using namespace std;

const int N=1e6+6;
vector< pair< ll, ll > > v[N];
vector< ll > u[N];
ll a[N], p[N];
ll b[N];

int main(){
	ll t, n, k, i, j, ind, rn, x, ans;
	
	scanf("%lld",&n);
	scanf("%lld",&k);
	
	for(i=1; i<=n; i++){
		for(j=1; j<=k; j++){
			scanf("%lld",&x);
			v[j].pb(mp(x, i));
		}
	}
	for(i=1; i<=n; i++){
		for(j=1; j<=k; j++){
			scanf("%lld",&x);
			u[i].pb(x);
		}
	}
	
	for(j=1; j<=k; j++){
		sort(v[j].begin(), v[j].end());
	}
	ans=0;
	ind=1;
	while(ans<n && ind==1){
		ind=0;
		vector< ll > R;
		for(i=1; i<=k; i++){
			while(v[i][p[i]].ff<=a[i] && p[i]<n){
				b[v[i][p[i]].ss]++;
				if(b[v[i][p[i]].ss]==k){
					R.pb(v[i][p[i]].ss);
				}
				p[i]++;
			}
		}
		rn=R.size();
		if(rn>0){
			ind++;
			ans+=rn;
		}
		for(i=0; i<rn; i++){
			for(j=0; j<k; j++){
				a[j+1]+=u[R[i]][j];
			}
		}
	}
	
	printf("%lld\n", ans);
	
	
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:17:5: warning: unused variable 't' [-Wunused-variable]
   17 |  ll t, n, k, i, j, ind, rn, x, ans;
      |     ^
Main.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  scanf("%lld",&n);
      |  ~~~~~^~~~~~~~~~~
Main.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  scanf("%lld",&k);
      |  ~~~~~^~~~~~~~~~~
Main.cpp:24:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |    scanf("%lld",&x);
      |    ~~~~~^~~~~~~~~~~
Main.cpp:30:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |    scanf("%lld",&x);
      |    ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 47960 KB Output is correct
2 Correct 10 ms 48124 KB Output is correct
3 Correct 14 ms 48608 KB Output is correct
4 Correct 241 ms 102136 KB Output is correct
5 Correct 246 ms 102320 KB Output is correct
6 Correct 290 ms 102308 KB Output is correct
7 Correct 222 ms 89176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 47964 KB Output is correct
2 Correct 10 ms 48116 KB Output is correct
3 Correct 11 ms 47964 KB Output is correct
4 Correct 11 ms 47964 KB Output is correct
5 Correct 12 ms 47968 KB Output is correct
6 Correct 12 ms 48076 KB Output is correct
7 Correct 13 ms 48476 KB Output is correct
8 Correct 12 ms 48476 KB Output is correct
9 Correct 12 ms 48476 KB Output is correct
10 Correct 13 ms 48396 KB Output is correct
11 Correct 16 ms 48704 KB Output is correct
12 Correct 13 ms 48332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 47964 KB Output is correct
2 Correct 10 ms 47964 KB Output is correct
3 Correct 13 ms 48584 KB Output is correct
4 Correct 42 ms 55080 KB Output is correct
5 Correct 47 ms 54980 KB Output is correct
6 Correct 357 ms 111784 KB Output is correct
7 Correct 549 ms 103092 KB Output is correct
8 Correct 360 ms 109520 KB Output is correct
9 Correct 516 ms 102700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 47960 KB Output is correct
2 Correct 10 ms 48124 KB Output is correct
3 Correct 14 ms 48608 KB Output is correct
4 Correct 241 ms 102136 KB Output is correct
5 Correct 246 ms 102320 KB Output is correct
6 Correct 290 ms 102308 KB Output is correct
7 Correct 222 ms 89176 KB Output is correct
8 Correct 10 ms 47964 KB Output is correct
9 Correct 10 ms 48116 KB Output is correct
10 Correct 11 ms 47964 KB Output is correct
11 Correct 11 ms 47964 KB Output is correct
12 Correct 12 ms 47968 KB Output is correct
13 Correct 12 ms 48076 KB Output is correct
14 Correct 13 ms 48476 KB Output is correct
15 Correct 12 ms 48476 KB Output is correct
16 Correct 12 ms 48476 KB Output is correct
17 Correct 13 ms 48396 KB Output is correct
18 Correct 16 ms 48704 KB Output is correct
19 Correct 13 ms 48332 KB Output is correct
20 Correct 10 ms 47964 KB Output is correct
21 Correct 10 ms 47964 KB Output is correct
22 Correct 13 ms 48584 KB Output is correct
23 Correct 42 ms 55080 KB Output is correct
24 Correct 47 ms 54980 KB Output is correct
25 Correct 357 ms 111784 KB Output is correct
26 Correct 549 ms 103092 KB Output is correct
27 Correct 360 ms 109520 KB Output is correct
28 Correct 516 ms 102700 KB Output is correct
29 Correct 278 ms 76720 KB Output is correct
30 Correct 237 ms 72068 KB Output is correct
31 Correct 315 ms 79920 KB Output is correct
32 Correct 223 ms 76560 KB Output is correct
33 Correct 245 ms 72080 KB Output is correct
34 Correct 250 ms 76428 KB Output is correct
35 Correct 307 ms 80060 KB Output is correct
36 Correct 241 ms 76604 KB Output is correct
37 Correct 276 ms 76580 KB Output is correct
38 Correct 223 ms 80500 KB Output is correct