# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
844245 | vjudge1 | Pod starim krovovima (COCI20_psk) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// clang-format off
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lg2(x) (63 - __builtin_clzll(x))
#define db cerr << "BREAK\n"
#define fp(...) fprintf(stderr, __VA_ARGS__)
#define rs(a) a.resize(n)
#define hizli cin.tie(0);ios_base::sync_with_stdio(0)
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(a, b) for (int a = 0; a < b; a++)
#define af(x) for(auto&a:x)fp("%d ",a);fp("\n")
#define ff first
#define ss second
#define zekochain main
// clang-format on
template <typename... Args> void in(Args &&...args) {
(std::cin >> ... >> args);
}
const int N = 2e5 + 5, MOD = 1e9 + 7;
struct bab{
ll li,vol,ind;
bool operator<(const bab &other){
return vol < other.vol;
}
};
int zekochain(){
int n;
cin >> n;
vector<bab> v(n);
for(int i=0;i<n;i++){
int a,b;
cin >> a >> b;
v[i]={a,-b,i};
}
ll sm = 0;
for(auto&i:v){
sm+=i.li;
}
sort(all(v));
vector<int> mp(n);
int i;
for( i=0;i<n && sm>0;i++){
mp[v[i].ind]=min(-v[i].vol,sm);
sm+=v[i].vol;
}
cout << n-i << endl;
for(auto&a:mp){
cout << a << ' ';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |