답안 #914143

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914143 2024-01-21T09:36:06 Z Litusiano Topical (NOI23_topical) C++17
12 / 100
193 ms 94216 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 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 1372 KB Output is correct
4 Correct 191 ms 94216 KB Output is correct
5 Correct 193 ms 94152 KB Output is correct
6 Correct 190 ms 94152 KB Output is correct
7 Correct 163 ms 94148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 1372 KB Output is correct
4 Correct 191 ms 94216 KB Output is correct
5 Correct 193 ms 94152 KB Output is correct
6 Correct 190 ms 94152 KB Output is correct
7 Correct 163 ms 94148 KB Output is correct
8 Correct 1 ms 504 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -