QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179813#5674. Sum of RemaindersCloudsWA 1ms3428kbC++141.1kb2023-09-15 10:13:012023-09-15 10:13:01

Judging History

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

  • [2023-09-15 10:13:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3428kb
  • [2023-09-15 10:13:01]
  • 提交

answer

#include<bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
const int N=1e3+10;

int a[N];
vector<int> ans;

signed main()
{
    int n;
    cin>>n;
    int cnt=0,sum=-1;
    int flag=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(i==1)
        {
            cnt=a[i];
            continue;
        }
        if(cnt==1&&a[i]==0&&flag==0)
        {
            flag=1;
            sum=a[i];
        }
    }
    if(flag)
    {
        cout<<1<<" "<<sum<<endl;
        return 0;
    }
    for(int i=2;i<=n;i++)
    {
        int ff=0;
        int sum=0,now=cnt-ans.size();
        for(auto x:ans)
        {
            sum+=i%x;
        }
        sum+=now*i;
        while(a[i]<sum)
        {
            sum-=i;
            ans.push_back(i);
            if(ans.size()==cnt)
            {
                ff=1;
                break;
            }
        }
        if(ff)
            break;
    }
    cout<<ans.size()<<" ";
    for(int i=0;i<ans.size();i++)
        cout<<ans[i]<<" ";
    cout<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

16
4 6 10 12 6 8 12 14 18 10
3 5 9 11 5 7

output:

4 2 5 5 11 

result:

ok single line: '4 2 5 5 11 '

Test #2:

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

input:

20
3 6 6 9 12 6 2 5 5 8
11 5 8 4 4 7 10 4 7 10

output:

3 3 6 7 

result:

ok single line: '3 3 6 7 '

Test #3:

score: 0
Accepted
time: 0ms
memory: 3424kb

input:

40
7 14 21 28 35 42 42 49 56 63
70 65 59 45 37 44 51 58 65 72
72 79 86 57 39 33 40 26 33 25
32 39 46 53 53 48 55 62 56 63

output:

7 7 12 13 14 15 24 25 

result:

ok single line: '7 7 12 13 14 15 24 25 '

Test #4:

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

input:

60
7 14 21 28 35 42 49 56 63 70
77 72 79 86 93 100 90 97 85 92
99 106 113 108 115 122 102 109 116 123
99 106 113 103 110 105 112 100 107 114
121 86 93 56 63 70 77 72 79 86
76 83 90 70 77 84 72 79 86 81

output:

7 12 17 19 27 31 42 44 

result:

ok single line: '7 12 17 19 27 31 42 44 '

Test #5:

score: -100
Wrong Answer
time: 1ms
memory: 3412kb

input:

20
1 2 3 4 5 6 7 8 0 1
2 3 4 5 6 7 8 0 1 2

output:

1 0

result:

wrong answer 1st lines differ - expected: '1 9', found: '1 0'