답안 #472843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472843 2021-09-14T11:48:11 Z SaraMostafa Hokej (COCI17_hokej) C++14
0 / 120
646 ms 41064 KB
#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define endl "\n"
#define Sara ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const long long mod=998244353;
const double PI=acos(-1);
struct sub
{
    ll t,a,b;
    sub(ll ti,ll ai,ll bi)
    {
        t=ti;
        a=ai;
        b=bi;
    }
};
int main()
{
    //freopen("input.in","r",stdin);
    Sara

    ll m,n;
    cin>>m>>n;
    vector<pair<ll,ll>>v(n);
    map<pair<ll,ll>,ll>mp;
    for(int i=0; i<n; i++)
    {
        cin>>v[i].first>>v[i].second;
        mp[ {v[i].first,v[i].second}]=i+1;
    }
    sort(v.rbegin(),v.rend());
    vector<sub>b;
    vector<ll>f(6);
    vector<pair<ll,ll>>c(6);
    for(int i=0; i<6; i++)
    {
        f[i]=mp[{v[i].first,v[i].second}];
        c[i]= {v[i].first,v[i].second};
    }
          ll id=6;
          ll cnt=0,sum=0;
    for(int i=1; i<=m; i++)
    {
        bool valid=1;
        sum=0;
        for(int j=0; j<6; j++)
        {
            if(c[j].second-i<0)
            {
                valid=0;
                for(int k=id; k<n; k++)
                {
                    b.push_back({i+1,mp[c[j]],mp[v[k]]});
                  c[j]=v[k];
                  id++;
                  valid=1;
                  break;
                }
            }
            sum+=c[j].first;
        }
        if(valid){
            cnt+=sum;
        }
    }
    cout<<cnt<<endl;
    for(int i=0;i<6;i++) cout<<f[i]<<' ';
    cout<<endl;
    cout<<b.size()<<endl;
    for(int i=0;i<b.size();i++){
        cout<<b[i].t<<' '<<b[i].a<<' '<<b[i].b<<endl;
    }
    return 0;
}

Compilation message

hokej.cpp: In function 'int main()':
hokej.cpp:72:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<sub>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |     for(int i=0;i<b.size();i++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 5 ms 784 KB Output isn't correct
3 Incorrect 24 ms 2088 KB Output isn't correct
4 Failed 1 ms 332 KB some player fainted
5 Incorrect 13 ms 1608 KB Output isn't correct
6 Incorrect 3 ms 716 KB Output isn't correct
7 Incorrect 5 ms 1020 KB Output isn't correct
8 Incorrect 77 ms 7876 KB Output isn't correct
9 Incorrect 646 ms 40232 KB Output isn't correct
10 Incorrect 642 ms 41064 KB Output isn't correct