제출 #1090013

#제출 시각아이디문제언어결과실행 시간메모리
1090013phong치료 계획 (JOI20_treatment)C++17
0 / 100
1 ms600 KiB
#include<bits/stdc++.h> #define ll long long #define int long long const int nmax = 1e3 + 5, M = 3e6 + 5; const ll oo = 1e18 + 5, base = 311; const int lg = 62, tx = 26; const ll mod = 1e9 + 7, mod2 = 1e9+3; #define pii pair<ll, ll> #define fi first #define se second #define endl "\n" #define debug(a, n) for(int i = 1; i <= n; ++i) cout << a[i] << ' '; cout << "\n"; #define NAME code using namespace std; int n, m; struct node{ int t, l, r, c; }a[nmax]; ll dp[nmax]; main(){ ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); // freopen("code.inp", "r", stdin); // freopen("code.out", "w", stdout); cin >> n >> m; for(int i = 1; i <= m; ++i) cin >> a[i].t >> a[i].l >> a[i].r >> a[i].c; sort(a + 1, a + 1 + m, [](node a, node b){ if(a.l == b.l) return a.r < b.r; return a.l < b.l; }); for(int i = 1; i <= m; ++i){ if(a[i].l == 1)dp[i] = a[i].c; else dp[i] = oo; } for(int i = 1; i <= m; ++i){ for(int j = 1; j < i; ++j){ if(a[j].r - a[i].l + 1 >= abs(a[j].t - a[i].t)){ dp[i] = min(dp[i], dp[j] + a[i].c); } } } int ans = oo; for(int i = 1; i <= m; ++i){ if(a[i].r == n) ans = min(ans, dp[i]); } // cout << dp[3] << ' '; if(ans == oo) cout << -1; else cout << ans; } /* 10 5 1 1 3 1 1 1 6 5 1 4 8 3 1 5 10 4 1 6 10 3 */

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

treatment.cpp:21:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   21 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...