| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1093891 | Roumak77 | Topical (NOI23_topical) | C++17 | 208 ms | 30960 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <limits>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
using namespace std;
using ll = long long;
void subtask1(ll n, ll k){
for(ll i = 0; i < k; i++){
ll temp;
cin >> temp;
if(temp > 0){
cout << 0 << endl;
return;
}
}
cout << 1 << endl;
}
void subtask3(ll n, ll k){
vector<pair<ll, ll>> list_n(n, {0, 0});
for(ll i = 0; i < n; i++){
cin >> list_n[i].first;
}
for(ll i = 0; i < n; i++){
cin >> list_n[i].second;
}
sort(list_n.begin(), list_n.end());
ll curr = 0;
for(ll i = 0; i < n; i++){
if(list_n[i].first <= curr){
curr += list_n[i].second;
}else{
cout << i << endl;
return;
}
}
cout << n << endl;
}
void subtask2(ll n, ll k){
vector<bool> vis(n, false);
vector<vector<pair<ll, ll>>> list_n(n, vector<pair<ll, ll>>(k, {0, 0}));
ll cnt = 0;
vector<ll> curr(k, 0);
for(ll i = 0; i < n; i++){
for(ll j = 0; j < k; j++){
cin >> list_n[i][j].first;
}
}
for(ll i = 0; i < n; i++){
for(ll j = 0; j < k; j++){
cin >> list_n[i][j].second;
}
}
while(cnt != n){
bool add = false;
for(ll i = 0; i < n; i++){
if(vis[i]){
continue;
}
bool pos = true;
for(ll j = 0; j < k; j++){
if(curr[j] < list_n[i][j].first){
pos = false;
break;
}
}
if(!pos){
continue;
}
for(ll j = 0; j < k; j++){
curr[j] += list_n[i][j].second;
}
vis[i] = true;
add=true;
cnt++;
}
if(!add){
break;
}
}
cout << cnt << endl;
}
void solve(){
ll n, k;
cin >> n >> k;
if(n == 1){
subtask1(n, k);
return;
}else if(k == 1){
subtask3(n, k);
return;
}else if(n <= 100 & k <= 100){
subtask2(n, k);
}
}
bool single = true;
int main(){
ios_base::sync_with_stdio(false);
cout.tie(0);
cin.tie(0);
ll t = 1;
if(!single) cin >> t;
while(t--){
solve();
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
