답안 #929177

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
929177 2024-02-17T20:57:37 Z Zena_Hossam Hokej (COCI17_hokej) C++14
0 / 120
220 ms 12144 KB
#include <bits/stdc++.h>
using namespace std;
#define fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define ll double
#define ll long long
#define F first
#define S second
#define sz size()
#define all(s) s.begin(),s.end()
#define all1(s) s.rbegin(),s.rend()
int main()
{
    // freopen("maxcross.in","r",stdin);freopen("maxcross.out","w",stdout);

    ll T=1;
    //cin>>T;ll oo=0;
    while(T--)
    {
        ll n,m;
        cin>>n>>m;
        pair<ll,pair<ll,ll>>arr[m];
        for(ll i=0; i<m; i++)
        {
            cin>>arr[i].first>>arr[i].second.first;
            arr[i].first*=min(arr[i].second.first,n);
            arr[i].second.second=i;
        }
        sort(arr,arr+m);
        reverse(arr,arr+m);
        ll c=0,s=0;
        priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>w;vector<ll>kk;
        for(ll i=0; i<6; i++)
        {
            s+=arr[i].first/arr[i].second.first;
            w.push({arr[i].second.first,arr[i].second.second});
            kk.push_back(arr[i].second.second+1);
        }//cout<<"\n";
        ll X=0;
        ll u=6;vector<pair<ll,pair<ll,ll>>>ee;
        while(X<n)
        {
            while(w.top().first==X)
            {
                while(u<m&&arr[u].second.first>n-X){//cout<<n-X<<" "<<arr[u].second.first<<" "<<u<<"\n";
                    arr[u].first=arr[u].first/arr[u].second.first*(n-X);
                    arr[u].second.first=n-X;
                    sort(arr+u+1,arr+m);
                }
                s-=arr[w.top().second].first/arr[w.top().second].second.first;
                ee.push_back({X,{w.top().second,arr[u].second.second}});
                s+=arr[u].first/arr[u].second.first;
                w.pop();w.push({arr[u].second.first+X,arr[u].second.second});//cout<<u<<" "<<arr[u].second.second<<" "<<X<<"\n";
                u++;
            }
            c+=s;
            X++;
        }
        cout<<c<<"\n";
        for(ll i=0;i<kk.sz;i++)cout<<kk[i]<<" ";cout<<"\n";cout<<ee.sz<<"\n";
        for(ll i=0;i<ee.sz;i++){
            cout<<ee[i].first<<" "<<ee[i].second.first+1<<" "<<ee[i].second.second+1<<"\n";
        }
    }
}

Compilation message

hokej.cpp: In function 'int main()':
hokej.cpp:59:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |         for(ll i=0;i<kk.sz;i++)cout<<kk[i]<<" ";cout<<"\n";cout<<ee.sz<<"\n";
      |                     ^
hokej.cpp:59:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   59 |         for(ll i=0;i<kk.sz;i++)cout<<kk[i]<<" ";cout<<"\n";cout<<ee.sz<<"\n";
      |         ^~~
hokej.cpp:59:49: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   59 |         for(ll i=0;i<kk.sz;i++)cout<<kk[i]<<" ";cout<<"\n";cout<<ee.sz<<"\n";
      |                                                 ^~~~
hokej.cpp:60:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |         for(ll i=0;i<ee.sz;i++){
      |                     ^
# 결과 실행 시간 메모리 Grader output
1 Failed 0 ms 348 KB the answer doesn't match with the value Z
2 Failed 3 ms 348 KB the answer doesn't match with the value Z
3 Failed 14 ms 860 KB the answer doesn't match with the value Z
4 Failed 1 ms 348 KB the answer doesn't match with the value Z
5 Failed 5 ms 756 KB the answer doesn't match with the value Z
6 Failed 2 ms 348 KB the answer doesn't match with the value Z
7 Incorrect 4 ms 636 KB Output isn't correct
8 Incorrect 41 ms 2652 KB Output isn't correct
9 Failed 213 ms 12120 KB CONTESTANT FOUND BETTER ANSWER THAN JURY
10 Failed 220 ms 12144 KB CONTESTANT FOUND BETTER ANSWER THAN JURY