提出 #76689427


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll a,b,c;

inline ll solo(ll x,ll y,ll z){
    if(x<=0||y<=0) return 0;
    if(x==1) return y>=2?1:0;
    if(y>=x){
        if(y==x && z>0) return x-1;
        return x;
    }
    else{
        if(y==1) return 0;
        return y;
    }
}

inline ll dual(ll a1,ll b1,ll c1,ll a2,ll b2,ll c2){
    ll best=0;
    for(ll x=0;x<=a1&&x<=b1;++x){
        if(x==1 && b1<2) continue;
        if(x>=2 && b1<x) continue;
        if(x>=2 && b1==x && c1==0?0:0) {}
        ll rem_a=a2-x;
        if(rem_a<0) continue;
        ll y_max=min(c2,rem_a);
        ll y=0;
        if(y_max>=1){
            if(y_max==1){
                if(rem_a>=2) y=1;
            }
            else{
                y=y_max;
                if(y>=2 && rem_a==y && x>0){
                    y=y-1;
                }
            }
        }
        best=max(best,x+y);
    }
    return best;
}

signed main(){
    int T;
    scanf("%d",&T);
    while(T--){
        scanf("%lld%lld%lld",&a,&b,&c);
        ll ans=0;
        ans=max(ans,solo(a,b,c));
        ans=max(ans,solo(b,c,a));
        ans=max(ans,solo(c,a,b));
        ans=max(ans,dual(a,b,c,c,a,b));
        ans=max(ans,dual(b,c,a,a,b,c));
        ans=max(ans,dual(c,a,b,b,c,a));
        printf("%lld\n",ans);
    }
    return 0;
}

提出情報

提出日時
問題 B - Circular RPS
ユーザ Chen_Zhen_DY
言語 C++23 (GCC 15.2.0)
得点 0
コード長 1383 Byte
結果 WA
実行時間 > 2000 ms
メモリ 3768 KiB

コンパイルエラー

./Main.cpp: In function 'll dual(ll, ll, ll, ll, ll, ll)':
./Main.cpp:20:43: warning: unused parameter 'b2' [-Wunused-parameter]
   20 | inline ll dual(ll a1,ll b1,ll c1,ll a2,ll b2,ll c2){
      |                                        ~~~^~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 500
結果
WA × 1
WA × 9
TLE × 10
セット名 テストケース
Sample 01_sample_01.txt
All 01_sample_01.txt, 02_small_01.txt, 02_small_02.txt, 02_small_03.txt, 02_small_04.txt, 02_small_05.txt, 02_small_06.txt, 02_small_07.txt, 02_small_08.txt, 03_rand_1_01.txt, 03_rand_1_02.txt, 03_rand_1_03.txt, 03_rand_1_04.txt, 03_rand_1_05.txt, 04_rand_2_01.txt, 04_rand_2_02.txt, 04_rand_2_03.txt, 04_rand_2_04.txt, 04_rand_2_05.txt
ケース名 結果 実行時間 メモリ
01_sample_01.txt WA 1 ms 3640 KiB
02_small_01.txt WA 516 ms 3728 KiB
02_small_02.txt WA 515 ms 3768 KiB
02_small_03.txt WA 515 ms 3764 KiB
02_small_04.txt WA 515 ms 3768 KiB
02_small_05.txt WA 515 ms 3764 KiB
02_small_06.txt WA 515 ms 3760 KiB
02_small_07.txt WA 515 ms 3740 KiB
02_small_08.txt WA 515 ms 3672 KiB
03_rand_1_01.txt TLE > 2000 ms 3256 KiB
03_rand_1_02.txt TLE > 2000 ms 3348 KiB
03_rand_1_03.txt TLE > 2000 ms 3288 KiB
03_rand_1_04.txt TLE > 2000 ms 3396 KiB
03_rand_1_05.txt TLE > 2000 ms 3572 KiB
04_rand_2_01.txt TLE > 2000 ms 3252 KiB
04_rand_2_02.txt TLE > 2000 ms 3392 KiB
04_rand_2_03.txt TLE > 2000 ms 3340 KiB
04_rand_2_04.txt TLE > 2000 ms 3500 KiB
04_rand_2_05.txt TLE > 2000 ms 3256 KiB