제출 #1110226

#제출 시각아이디문제언어결과실행 시간메모리
1110226vjudge1Ski 2 (JOI24_ski2)C++17
5 / 100
1 ms592 KiB
#include <bits/stdc++.h>
using namespace std;

#define ff(i, a, b) for(auto i=(a); i<=(b); ++i)
#define ffr(i, b, a) for(auto i=(b); i>=(a); --i)
#define nl "\n"
#define ss " "
#define pb emplace_back
#define fi first
#define se second
#define sz(s) (int)s.size()
#define ms(a,x) memset(a, x, sizeof (a))
#define re exit(0)
#define cn continue

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;


const int mod=1e9+7;
//const int mod=998244353;
const int maxn=1e5+105;
const int maxm=4*maxn+5;
const ll inf=1e18;

mt19937 ran(time(0));
mt19937_64 ran64(time(0));

void rf(){

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if(fopen("o.inp","r")){
        freopen("o.inp","r",stdin); freopen("o.out","w",stdout);
    }
}

void add(int &x, int y)
{
    x+=y;
    if(x>=mod) x-=mod;
    if(x<0) x+=mod;
}

ll n, k;
pll p[maxn];

signed main()
{
    rf();
    cin>>n>>k;
    ff(i, 1, n) cin>>p[i].fi>>p[i].se;
    sort(p+1, p+n+1);
    ll ans=0, sl=1;
    ff(i, 2, n)
    {
        if(p[i].fi==p[1].fi) ++p[i].fi, ans+=k;
        else break;
    }
    ll mn=p[1].se;
    ff(i, 2, n)
    {
        int j=i;
        while(j<=n && p[i].fi==p[j].fi) ++j;
        ff(k, i, j-1)
        {
            if(sl>0) --sl;
            else ans+=mn;
        }
        ff(k, i, j-1)
        {
            mn=min(mn, p[k].se);
            ++sl;
        }
        i=j-1;
    }
    cout<<ans;
    re;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'void rf()':
Main.cpp:41:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |         freopen("o.inp","r",stdin); freopen("o.out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~
Main.cpp:41:44: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |         freopen("o.inp","r",stdin); freopen("o.out","w",stdout);
      |                                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...