# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
886016 | vjudge1 | Curtains (NOI23_curtains) | C++17 | 768 ms | 720080 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define sp " "
#define endl "\n"
#define pii pair<int, int>
#define st first
#define nd second
#define pb push_back
#define N 300005
const int INF = 1e9 + 7;
int32_t main(){
fileio();
fastio();
int n, k;
cin>>n>>k;
vector<pii> todo[k + 5];
vector<int> req(n + 5, k), arr(k + 5, 0);
vector<vector<int>> r(n + 5, vector<int>(k + 5, 0));
vector<vector<int>> u = r;
for (int i = 1; i <= n; i++){
for (int j = 1; j <= k; j++){
cin>>r[i][j];
if (r[i][j] == 0) req[i]--;
else todo[j].pb({r[i][j], i});
}
}
for (int i = 1; i <= k; i++){
sort(todo[i].rbegin(), todo[i].rend());
}
for (int i = 1; i <= n; i++){
for (int j = 1; j <= k; j++)
cin>>u[i][j];
}
queue<int> q;
for (int i = 1; i <= n; i++){
if (req[i] == 0) q.push(i);
}
auto add = [&](int top, int val){
arr[top] += val;
while(!todo[top].empty() && todo[top].back().st <= arr[top]){
int nxt = todo[top].back().nd;
todo[top].pop_back();
req[nxt]--;
if (req[nxt] == 0) q.push(nxt);
}
};
int ans = 0;
while(!q.empty()){
ans++;
int top = q.front();
q.pop();
for (int i = 1; i <= k; i++)
add(i, u[top][i]);
}
cout<<ans<<endl;
cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<" seconds\n";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |