提交记录 9133
| 用户 | 题目 | 状态 | 得分 | 用时 | 内存 | 语言 | 代码长度 |
|---|---|---|---|---|---|---|---|
| beretty | noi17e. 【NOI2017】蔬菜 | Runtime Error | 72 | 3 s | 22304 KB | C++11 | 2.77 KB |
| 提交时间 | 评测时间 |
|---|---|
| 2019-04-14 15:01:11 | 2020-08-01 01:33:37 |
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<iostream>
# define int long long
const int M = 500005 ;
const int INF = 1e18 ;
using namespace std ;
inline int read(){
char c = getchar() ; int x = 0 , w = 1 ;
while(c>'9'||c<'0') { if(c=='-') w = -1 ; c = getchar() ; }
while(c>='0'&&c<='9'){ x = x*10+c - '0' ; c = getchar() ; }
return x*w ;
}
int n , m , T ;
int a[M] , s[M] , x[M] , c[M] ;
struct Node{
int Res , val , id ; bool Isfirst ;
inline friend bool operator < (Node a , Node b){
return a.val < b.val ;
}
};
struct Vegetable{
int a , s , c , x , upp ;
inline friend bool operator < (Vegetable a , Vegetable b){
return a.upp > b.upp ;
}
}v[M];
int tag[M] , tnum ;
priority_queue<Node>q;
Node u ;
bool f ;
Node temp[105] ;
inline bool Deal(int k){
if(u.Res) {
f = 1 ;
return true ;
}
int i = u.id ;
if(tag[i] == k) return false ;
f = 1 ;
u.Res += (tag[i] - k) * v[i].x ;
tag[i] = k ;
return true ;
}
inline int Solve(int k){
while(!q.empty()) q.pop() ;
memset(tag , 0 , sizeof(tag)) ;
int Ans = 0 , now = 1 ;
for(int i=k;i>=1;i--){
for(int j=now;j<=n;j++)
if(v[j].upp >= i){
if(j == n) now = INF ;
tag[j] = i ;
q.push((Node){1 , v[j].a + v[j].s , j , true }) ;
q.push((Node){v[j].c - (i - 1) * v[j].x - 1 , v[j].a , j , false }) ;
}
else{
now = j ;
break ;
}
int num = m ;
tnum = 0 ;
while(num && !q.empty()){
Node u = q.top() ; q.pop() ;
if(u.Isfirst){
--num ;
Ans += u.val ;
continue ;
}
else{
int x = u.id ;
u.Res += (tag[x] - i) * v[x].x ;
tag[x] = i ;
if(u.Res <= num){
Ans += u.val * u.Res ;
num -= u.Res ;
u.Res = 0 ;
}
else{
Ans += u.val * num ;
u.Res -= num ;
num = 0 ;
}
temp[++tnum] = u ;
}
}
for(int j=1;j<=tnum;j++) q.push(temp[j]) ;
}
return Ans ;
}
# undef int
int main(){
# define int long long
n = read() ; m = read() ; T = read() ;
for(int i=1;i<=n;i++){
v[i].a = read() ; v[i].s = read() ;
v[i].c = read() ; v[i].x = read() ;
if(v[i].x == 0) v[i].upp = INF ;
else v[i].upp = ceil((double)v[i].c/v[i].x) ;
}
sort(v + 1 , v + n + 1) ;
while(T--){
int x = read() ;
printf("%lld\n",Solve(x)) ;
}
return 0 ;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 98.464 ms | 3 MB + 888 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #2 | 101.354 ms | 3 MB + 892 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #3 | 107.064 ms | 3 MB + 892 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #4 | 686.62 us | 4 MB + 24 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #5 | 929.93 us | 4 MB + 24 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #6 | 1.038 ms | 4 MB + 24 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #7 | 596.88 us | 3 MB + 880 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #8 | 761.4 us | 3 MB + 884 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #9 | 926.05 us | 3 MB + 884 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #10 | 1.098 ms | 3 MB + 884 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #11 | 1.945 ms | 3 MB + 884 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #12 | 10.589 ms | 3 MB + 900 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #13 | 17.51 ms | 3 MB + 900 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #14 | 10.36 ms | 3 MB + 900 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #15 | 10.243 ms | 3 MB + 900 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #16 | 708.27 us | 4 MB + 20 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #17 | 351.606 ms | 4 MB + 36 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #18 | 773.8 us | 4 MB + 20 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #19 | 324.68 ms | 4 MB + 36 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #20 | 322.115 ms | 4 MB + 36 KB | Accepted | Score: 4 | 显示更多 |
| Testcase #21 | 12.721 ms | 21 MB + 800 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #22 | 3 s | 21 MB + 800 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #23 | 15.017 ms | 21 MB + 800 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #24 | 3 s | 21 MB + 560 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #25 | 3 s | 21 MB + 548 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-04-04 19:42:45 | Loaded in 2 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠