Submission #1163548

#TimeUsernameProblemLanguageResultExecution timeMemory
1163548salmonAkcija (COCI21_akcija)C++20
30 / 110
2 ms328 KiB
#include <bits/stdc++.h> using namespace std; int N; int k; long long int memo[2100]; vector<int> v; const long long int inf = 1.1e18; vector<int> W[2100]; int main(){ scanf(" %d",&N); scanf(" %d",&k); for(int i = 0; i < N; i++){ int w; int d; scanf(" %d",&w); scanf(" %d",&d); W[d].push_back(w); } for(int j = 0; j <= N; j++) memo[j] = inf; memo[0] = 0; for(int i = 0; i <= N; i++){ for(int l : W[i]){ for(int j = i; j >= 1; j--){ memo[j] = min(memo[j],memo[j - 1] + l); } } } for(int i = N; i >= 0; i--){ if(memo[i] != inf){ printf("%d %lld",i,memo[i]); break; } } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf(" %d",&N);
      |         ~~~~~^~~~~~~~~~
Main.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf(" %d",&k);
      |         ~~~~~^~~~~~~~~~
Main.cpp:19:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |                 scanf(" %d",&w);
      |                 ~~~~~^~~~~~~~~~
Main.cpp:20:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |                 scanf(" %d",&d);
      |                 ~~~~~^~~~~~~~~~
#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...