QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#816687 | #1417. Koala | modwwe | 20 | 2ms | 7720kb | C++23 | 2.1kb | 2024-12-16 16:33:44 | 2024-12-16 16:33:45 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define down cout<<'\n';
#define debug cout<<" cucuucucuuu",down
#define NHP ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define modwwe int t;cin>>t; while(t--)
#define bit(i,j) (i>>j&1)
#define sobit(a) __builtin_popcountll(a)
#define task "test"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".out","w",stdout)
#define pb push_back
#define mask(k) (1<<k)
#define mp make_pair
#define checktime cerr << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms";
using namespace std;
#define getchar_unlocked getchar
inline int scan()
{
char c = getchar_unlocked();
int x = 0;
while (c < '0' || c > '9')
{
c = getchar_unlocked();
}
while (c >= '0' && c <= '9')
{
x = (x << 1) + (x << 3) + c - '0';
c = getchar_unlocked();
}
return x;
}
void phongbeo();
const int inf = 2e18;
const ll mod2 = 998244353;
const int mod1 = 998244353;
const ll base=67;
int add(int x,int y)
{
if(x+y>=mod2) x-=mod2;
if(x+y<0)x+=mod2;
return x+y;
}
struct icd
{
long double a;
int b;
};
struct ib
{
int a;
int b;
};
struct ic
{
int a, b, c;
};
struct id
{
int a, b, c, d;
};
struct ie
{
int a, b, c, d, e;
};
int n, m, s1, s2, s4, s3, sf, k, s5, s6, mx, s7, s8, s9, mx2, res, dem2 = 0, dem = 0, s33, dem3, dem4, mid, l2, r2, center;
int i, s10, s12,k1,k2,k3,s11,lim,w,l,r,ans ;
int kk;
int el = 19;
main()
{
if(fopen(task".inp","r"))
{
fin(task);
fou(task);
}
NHP
/// cin>>s1;
//modwwe
phongbeo(),down
// checktime
}
int t[400010];
int pos[100010];
int money[100010];
int f[100010];
int dp[100010];
int cost;
void phongbeo()
{
cin>>pos[0]>>m>>lim>>cost>>n;
for(int i=1; i<=n; i++)
cin>>pos[i]>>money[i];
pos[++n]=m;
dp[0]=0;
for(int i=1;i<=n;i++)
dp[i]=-inf;
for(int i=1;i<=n;i++){
for(int j=0;j<i;j++)
dp[i]=max(dp[i],dp[j]+money[i]-((pos[i]-pos[j]-1)/lim +1)*cost);
}
cout<<dp[n];
}
詳細信息
Subtask #1:
score: 20
Accepted
Test #1:
score: 20
Accepted
time: 0ms
memory: 5672kb
input:
0 1000000000 10000000 1000000000 1000 766594 794913448 1022483 968808438 1860689 180172081 2612232 892233378 2711430 697456060 5861026 124399766 5872975 456109107 7305789 234223988 8856152 121809429 10395082 536579115 10727357 153804291 11383333 264987716 11710888 259494565 12650062 743133027 128343...
output:
-20986219947
result:
ok single line: '-20986219947'
Test #2:
score: 20
Accepted
time: 2ms
memory: 5780kb
input:
0 1000000000 100000000 1000000000 1000 408056 64291257 950729 417401194 1121456 485348868 1217960 194100399 1308702 23317250 1423934 816813094 1749013 272196714 2492231 614511892 2610673 465297899 3201044 998974907 3779675 17039455 4120320 438731899 5428489 237634880 5598516 15570543 5992567 3013002...
output:
-1206167121
result:
ok single line: '-1206167121'
Test #3:
score: 20
Accepted
time: 2ms
memory: 5692kb
input:
26645731 919542575 22846294 296541838 903 27350409 78559054 28074926 581246125 30233963 220622542 31204435 622433956 31428229 264695771 31535964 86753263 32029007 429287704 32124260 532791582 32162878 237287536 32909321 575845401 33489551 317180656 33950989 658312538 34438418 324511420 34897246 3843...
output:
105600825037
result:
ok single line: '105600825037'
Test #4:
score: 20
Accepted
time: 1ms
memory: 5700kb
input:
72620144 977888981 75318382 616914503 213 84582760 112948992 89116876 85442912 91787391 10785738 97766203 114304857 101563355 36343271 104865720 16060262 107255079 22772570 109495295 64882931 111321431 107980991 111963837 115224953 118147031 57771636 124696121 97844526 127348114 68770612 127597444 9...
output:
-7039664548
result:
ok single line: '-7039664548'
Test #5:
score: 20
Accepted
time: 2ms
memory: 7720kb
input:
0 1001 1 1000000000 1000 1 147349793 2 709439639 3 695200296 4 341338582 5 599798661 6 383702756 7 133207304 8 358573839 9 971985350 10 510068148 11 330163022 12 422234013 13 692480786 14 974211672 15 498600562 16 487669297 17 729460253 18 835233205 19 739006916 20 465062736 21 546717504 22 22225761...
output:
-534857336300
result:
ok single line: '-534857336300'
Test #6:
score: 20
Accepted
time: 2ms
memory: 5692kb
input:
0 1001 10 1000000000 1000 1 413413470 2 360945298 3 869910289 4 993845067 5 341460882 6 596529228 7 184673611 8 70281083 9 740966694 10 773108599 11 102078977 12 210025207 13 149519016 14 517415076 15 856249018 16 623416485 17 995206045 18 104288585 19 948532885 20 698480872 21 966045622 22 42782632...
output:
-18988791303
result:
ok single line: '-18988791303'
Test #7:
score: 20
Accepted
time: 0ms
memory: 5608kb
input:
0 1000000000 10 1000000000 1 632841892 982641380
output:
-100000000000000000
result:
ok single line: '-100000000000000000'
Test #8:
score: 20
Accepted
time: 2ms
memory: 5664kb
input:
0 1000000000 1 1000000000 1000 2338950 68591699 3498242 819629784 4626016 594127698 5146533 857657692 5183846 470462177 5901416 728419346 6866033 508858847 8617386 372062339 9862970 267956337 9918015 185403748 10210330 173336808 11071915 319359405 11405232 664655076 12433483 898920025 12475622 25487...
output:
-999999517341219479
result:
ok single line: '-999999517341219479'
Test #9:
score: 20
Accepted
time: 2ms
memory: 5624kb
input:
0 1000000000 1000000000 1000000000 1000 2283703 669131753 2806408 614362507 3262242 904571617 3454624 233633137 6805050 839261038 6842053 66092059 7441156 428445510 7485871 922522259 7523568 968241353 7776507 549985163 8425623 931579752 8744700 326434498 9662722 826703370 10277977 886982661 10278571...
output:
-1000000000
result:
ok single line: '-1000000000'
Test #10:
score: 20
Accepted
time: 2ms
memory: 5688kb
input:
0 1000000000 10000000 1 1000 2330621 1 2391142 1 2637593 1 2870473 1 3844721 1 4314095 1 4565748 1 5946301 1 6233796 1 6712240 1 7493340 1 8877636 1 9726847 1 11819802 1 12249341 1 12346214 1 12862264 1 13584461 1 13613611 1 14806277 1 14899049 1 15209019 1 15658375 1 16052722 1 17037666 1 17103038 ...
output:
-1
result:
ok single line: '-1'
Subtask #2:
score: 0
Time Limit Exceeded
Test #11:
score: 0
Time Limit Exceeded
input:
0 1000000000 100 1000000000 100000 10772 16498783 27514 413778647 32249 449299239 53881 944379333 55734 183512821 62266 707895369 62469 904347879 68808 405268726 75498 790216188 79387 728293682 84310 495444679 101416 234259135 104472 579651819 105055 195282273 115325 700682475 126862 424126393 13589...
output:
result:
Subtask #3:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%