QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#412790#5260. The GameLiberty12619#WA 0ms3680kbC++201.8kb2024-05-16 19:32:262024-05-16 19:32:27

Judging History

This is the latest submission verdict.

  • [2024-05-16 19:32:27]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3680kb
  • [2024-05-16 19:32:26]
  • Submitted

answer

#include <bits/stdc++.h>
#define x first
#define y second
#define int long long
using namespace std;
typedef pair<int,int> PII;
const int N = 1e6+10,mod = 998244353,INF=1e12;
void solve()
{
    vector<vector<int>>ans(4,vector<int>(1,1));
    ans[2][0]=ans[3][0]=100;
    vector<int>draws(98,0);
    for(int i=0;i<98;i++)   cin>>draws[i];
    int t=0,cnt=0;
    vector<int>nums;
    auto op = [&]()
    {
        int minv = 110;
        PII res;
        for(int i=0;i<nums.size();i++)
            for(int j=0;j<4;j++)
            {
                int t = ans[j].back();
                if(abs(nums[i]-t)<minv)
                {
                    minv = abs(nums[i]-t);
                    res = {i,j};
                }
                if(abs(nums[i]-t)==10)
                {
                    ans[j].push_back(nums[i]);
                    nums.erase(nums.begin()+i);
                    cnt--;
                    return;
                }
            }
        ans[res.y].push_back(nums[res.x]);
        nums.erase(nums.begin()+res.x);
        cnt--;
    };
    while(t<98||cnt)
    {
        while(cnt<8&&t<98)
        {
            nums.push_back(draws[t++]);
            cnt++;
        }
        //cout<<cnt<<"!!!!!!\n";
        op(),op();
    }
    for(int i=0;i<4;i++)
    {
        for(int j : ans[i])    cout<<j<<" ";
        cout<<"\n";
    }
}

signed main()
{
    int T=1;
    //cin.tie(0)->sync_with_stdio(false);
    //cin>>T;
    while(T--)
    {
        solve();
    }
    return 0;
}
/*
96 69 40 94 35 7 53 88 10 89 47 37 16 61 24 46 90 6 33 25 63 73 26 81 2 45
77 75 48 57 66 34 59 92 44 11 31 18 9 52 91 50 8 98 5 64 86 62 83 4 19
3 27 97 28 36 23 76 58 30 38 12 39 78 41 56 80 67 70 99 13 42 17 49 84
22 32 29 54 71 51 74 79 95 72 15 87 21 65 68 60 85 55 43 93 20 82 14
 */

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3680kb

input:

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

output:

1 2 3 4 5 6 7 8 9 10 20 19 21 22 23 24 25 26 27 37 36 46 47 48 38 39 49 50 40 
1 11 12 13 14 15 16 17 18 28 29 30 31 32 33 34 35 45 44 43 42 41 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 99 98 
100 90 91 92 93 94 95 96 97 
100 

result:

wrong answer 1st lines differ - expected: '1 2 3 4 5 6 7 8 9 10 11 12 13 ...9 90 91 92 93 94 95 96 97 98 99', found: '1 2 3 4 5 6 7 8 9 10 20 19 21 ... 37 36 46 47 48 38 39 49 50 40 '