QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#339624#8276. Code CongestionIsaacQTL 2ms3732kbC++141.2kb2024-02-27 18:00:092024-02-27 18:00:10

Judging History

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

  • [2024-02-27 18:00:10]
  • 评测
  • 测评结果:TL
  • 用时:2ms
  • 内存:3732kb
  • [2024-02-27 18:00:09]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define pii pair<int,int>
using namespace std;
const ll N = 1e9;
const ll mod = 998244353;
ll sum = 0;
int n, T;
void get(ll a[], ll t[], int vis[], int ind)
{
    if(ind == n) 
    {
        int cons = 0;
        for(int i=0; i<n; i++)
        {
            if(vis[i] == 0) 
            {
                if(cons + t[i] <= T) 
                {
                    sum = (sum + a[i]) % mod;
                    cons += t[i];
                }
                else return;
            }
        }

        for(int i=0; i<n; i++)
        {
            if(vis[i] == 1)
            {
                if(cons + t[i] <= T)
                {
                    sum = (sum + a[i]) % mod;
                    cons += t[i];
                }
                else return;
            }
        }
        return;
    }

    vis[ind] = 0;
    get(a,t,vis,ind+1);
    vis[ind] = 1;
    get(a,t,vis,ind+1);

}
void solve()
{
    ll a[n];
    int vis[n] = {0};
    ll t[n];
    for(int i=0; i<n; i++) cin >> a[i];

    for(int j=0; j<n; j++) cin >> t[j];


    get(a,t,vis,0);
    cout << sum << endl;
}
int main()
{
    cin >> n >> T;
    solve();
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3652kb

input:

3 3
2 3 4
1 2 2

output:

40

result:

ok 1 number(s): "40"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

13 96
56231 258305 150103 164646 232643 37457 239584 192517 167805 215281 159832 98020 141006
54 1 38 1 4 1 4 11 1 4 8 22 1

output:

745634757

result:

ok 1 number(s): "745634757"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

14 86
205026 38691 58462 59767 205360 152715 7879 105238 33507 280429 54906 248241 102327 202931
1 49 1 1 5 12 1 5 9 18 1 1 3 32

output:

310231569

result:

ok 1 number(s): "310231569"

Test #4:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

14 85
82111 267744 229782 32542 260127 152775 1364 293699 23965 242667 264864 219673 189482 12945
1 5 1 1 2 1 38 14 1 3 4 1 21 53

output:

745175834

result:

ok 1 number(s): "745175834"

Test #5:

score: 0
Accepted
time: 2ms
memory: 3732kb

input:

15 94
119505 80865 95965 30047 68261 120903 113180 192738 220899 279742 32609 275645 38640 213859 282516
1 1 8 15 1 3 1 38 6 1 23 57 1 5 79

output:

970187257

result:

ok 1 number(s): "970187257"

Test #6:

score: -100
Time Limit Exceeded

input:

200 91
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:


result: