답안 #914147

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914147 2024-01-21T09:38:38 Z Litusiano Topical (NOI23_topical) C++17
33 / 100
487 ms 189268 KB
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define int long long

bool cmp(pair<int,int> a, pair<int,int> b){
	return a.second < b.second;
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,k; cin>>n>>k;
	vector<vector<int>> r(n,vector<int>(k,0)); auto u = r;
	for(auto& x : r){
		for(auto& i : x) cin>>i;
	}
	for(auto& x : u){
		for(auto& i : x) cin>>i;
	}
	vector<vector<tuple<int,int,int>>> idx(k);
	vector<int> pt(k);
	for(int i = 0; i<k; i++){
		for(int j = 0; j<n; j++){
			idx[i].push_back({r[j][i], -u[j][i],j});
		}
		sort(idx[i].begin(), idx[i].end());
		// can go from i to i+1 if and only if in this topic if r[i][j] + u[i][j] >= r[z][j]   
	}
	// for all i, just see until where can i get
	vector<vector<int>> used(n, vector<int>(k,0));
	for(int i = 0; i<k; i++){
		int act = 0;
		for(auto x : idx[i]){
			int rt,ut,id;
			tie(rt,ut,id) = x;
			if(rt <= act){
				act-= ut; used[id][i] = 1;
			}
		}
	}
	int ans = 0;
	for(auto i : used){
		int s = 0;
		for(int j : i) s+=j;
		if(s == k) ans++;
	}
	cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 3 ms 1372 KB Output is correct
4 Correct 190 ms 94196 KB Output is correct
5 Correct 187 ms 94176 KB Output is correct
6 Correct 190 ms 94148 KB Output is correct
7 Correct 169 ms 94148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 5 ms 2328 KB Output is correct
4 Correct 46 ms 19004 KB Output is correct
5 Correct 43 ms 19652 KB Output is correct
6 Correct 487 ms 188196 KB Output is correct
7 Correct 465 ms 188584 KB Output is correct
8 Correct 484 ms 189268 KB Output is correct
9 Correct 468 ms 188452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 3 ms 1372 KB Output is correct
4 Correct 190 ms 94196 KB Output is correct
5 Correct 187 ms 94176 KB Output is correct
6 Correct 190 ms 94148 KB Output is correct
7 Correct 169 ms 94148 KB Output is correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Halted 0 ms 0 KB -