제출 #1128460

#제출 시각아이디문제언어결과실행 시간메모리
1128460KasymKToll (BOI17_toll)C++20
46 / 100
3089 ms1664 KiB
// I want to go high as fuck tonight... // Music name => (Gyzyl Ysyk) // Authors: A$OK, SazYelme, Swizzy347 and Ma.Gallery // Hash your favorite words. #include "bits/stdc++.h" #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int N = 5e4+5; const int K = 5; const int INF = 1e9; int mal[N][K], dp[N]; int main(){ // freopen("file.txt", "r", stdin); int k, n, m, q; scanf("%d%d%d%d", &k, &n, &m, &q); memset(mal, 65, sizeof mal); while(m--){ int a, b, c; scanf("%d%d%d", &a, &b, &c); mal[a][b%k]=c; } while(q--){ int a, b; scanf("%d%d", &a, &b); dp[a]=0; for(int i = a+1; i <= b; ++i) dp[i]=INF; for(int i = a; i < (b/k)*k; ++i) for(int j = 0; j < k; ++j) umin(dp[(i/k)*k+k+j], dp[i]+mal[i][j]); if(dp[b]==INF) puts("-1"); else printf("%d\n", dp[b]); } return 0; }

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

toll.cpp: In function 'int main()':
toll.cpp:30:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     scanf("%d%d%d%d", &k, &n, &m, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
toll.cpp:34:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |         scanf("%d%d%d", &a, &b, &c);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
toll.cpp:39:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |         scanf("%d%d", &a, &b);
      |         ~~~~~^~~~~~~~~~~~~~~~
#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...