제출 #1110286

#제출 시각아이디문제언어결과실행 시간메모리
1110286vjudge1Ski 2 (JOI24_ski2)C++17
5 / 100
1 ms504 KiB
#include <bits/stdc++.h> #define fi(i, a, b) for( int i = a; i <= b; i++ ) #define fid(i, a, b) for( int i = a; i >= b; i-- ) #define getbit(x, i) ((x>>i)&1) #define ll long long #define pb push_back #define pii pair<int,int> #define pli pair<ll,int> #define pll pair<ll,ll> #define st first #define nd second #define mp make_pair #define HTManh "" #define maxn 100009 #define endl '\n' using namespace std; int n; ll k; pll a[309]; ll dp[309]; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); if (fopen(HTManh".inp", "r")) { freopen(HTManh".inp", "r", stdin); freopen(HTManh".out", "w", stdout); } cin >> n >> k; fi(i,1,n) cin >> a[i].st >> a[i].nd; sort(a+1,a+n+1); int vt = 0; fi(i,1,n+1) if (a[i].st != a[1].st || i == n+1) { vt = i-1; break; } ll res = 0; fi(i,2,vt) { a[i].st++; res += k; } ll mn, dem; mn = a[1].nd, dem = 1; int dau = 2, cuoi = 2; while(dau <= n) { while(a[dau].st == a[cuoi].st && cuoi <= n) cuoi++; cuoi--; fi(i,dau,cuoi) { if (dem > 0) dem--; else res += mn; } fi(i,dau,cuoi) mn = min(mn, a[i].nd); dem += cuoi-dau+1; dau = cuoi + 1; cuoi = dau; } cout << res << endl; }

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

Main.cpp: In function 'int main()':
Main.cpp:30:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |         freopen(HTManh".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:31:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |         freopen(HTManh".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...