QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#375893#6823. Coffee OverdoseschrodingerstomWA 8ms3872kbC++141.5kb2024-04-03 16:53:422024-04-03 16:53:43

Judging History

你现在查看的是最新测评结果

  • [2024-04-08 20:49:53]
  • hack成功,自动添加数据
  • (/hack/589)
  • [2024-04-03 16:53:43]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:3872kb
  • [2024-04-03 16:53:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
bool memBeg;
template<typename T,typename TT> void chkmin(T &x,TT y) {if(x>y) x=y;}
template<typename T,typename TT> void chkmax(T &x,TT y) {if(x<y) x=y;}
constexpr int mod=998244353;
void inc(int &x,int y) {x+=y; x-=(x>=mod)*mod;}
void dec(int &x,int y) {x-=y; x+=(x<0)*mod;}
constexpr int add(int x,int y) {return (x+y>=mod)?x+y-mod:x+y;}
constexpr int sub(int x,int y) {return (x<y)?x-y+mod:x-y;}
constexpr int quick_pow(int x,ll times,int ret=1) {
    for(;times;times>>=1,x=1ll*x*x%mod) if(times&1) ret=1ll*ret*x%mod;
    return ret;
}
bool memEn;
void fl() {
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
}
int main() {
    fprintf(stderr,"%.24lf\n",fabs(&memEn-&memBeg)/1024.0/1024.0);
    // fl();
    int _; scanf("%d",&_);
    int tur=0;
    while(_--) {
        int s,c;
        scanf("%d%d",&s,&c);
        if(++tur==9006) {
            printf("%d %d\n",s,c);
        }
        ll ret=0ll;
        {
            int a=s/(c+1),lo=s-a*(c+1),hi=s;
            ll t=1ll*(lo+hi)*(a+1)/2*c;
            chkmax(ret,t);
        }
        {
            int tk=min(c/2,(s+1)/(c+1));
            // printf("tk = %d\n",tk);
            ll y=1ll*s*(s+1)/2+1ll*c*(c-1)/2*tk-1ll*tk*(tk-1)/2*c;
            chkmax(ret,y);
            // printf("y = %lld\n",y);
        }
        if(_<10) printf("%lld\n",ret);
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3812kb

input:

4
1 2
2 1
10 4
172800 172800

output:

2
3
63
29859840000

result:

ok 4 tokens

Test #2:

score: -100
Wrong Answer
time: 8ms
memory: 3872kb

input:

100000
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 ...

output:

19 6
98200
98400
98600
98800
99000
99200
99400
99600
99800
100000

result:

wrong answer 1st words differ - expected: '1', found: '19'