Submission #852954

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8529542023-09-23 09:00:52MickeyIsAwesomeKnapsack (NOI18_knapsack)C++14
100 / 100
55 ms5384 KiB
#include <bits/stdc++.h> // Include every standard library
// Common file
#include <ext/pb_ds/assoc_container.hpp>
// Including tree_order_statistics_node_update
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<pll> vll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<ld> vd;
typedef vector<vd> vvd;
typedef pair<ll,pll> ppll;
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

knapsack.cpp: In function 'int main()':
knapsack.cpp:39:29: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   39 | #define FOR(a, b, c) for (ll(a) = (b); (a) < (c); ++(a))
      |                             ^
knapsack.cpp:45:19: note: in expansion of macro 'FOR'
   45 | #define rep(i, n) FOR(i, 0, n)
      |                   ^~~
knapsack.cpp:250:5: note: in expansion of macro 'rep'
  250 |     rep(i,n){
      |     ^~~
knapsack.cpp:39:29: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   39 | #define FOR(a, b, c) for (ll(a) = (b); (a) < (c); ++(a))
      |                             ^
knapsack.cpp:45:19: note: in expansion of macro 'FOR'
   45 | #define rep(i, n) FOR(i, 0, n)
      |                   ^~~
knapsack.cpp:254:5: note: in expansion of macro 'rep'
  254 |     rep(i,n){
      |     ^~~
knapsack.cpp:40:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   40 | #define FORN(a, b, c) for (ll(a) = (b); (a) <= (c); ++(a))
      |                              ^
knapsack.cpp:257:5: note: in expansion of macro 'FORN'
  257 |     FORN(i,1,s) sort(item[i].begin(), item[i].end(), compf);
      |     ^~~~
knapsack.cpp:40:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   40 | #define FORN(a, b, c) for (ll(a) = (b); (a) <= (c); ++(a))
      |                              ^
knapsack.cpp:259:5: note: in expansion of macro 'FORN'
  259 |     FORN(i,1,s) best[i].pb(0);
      |     ^~~~
knapsack.cpp:40:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   40 | #define FORN(a, b, c) for (ll(a) = (b); (a) <= (c); ++(a))
      |                              ^
knapsack.cpp:261:5: note: in expansion of macro 'FORN'
  261 |     FORN(i,1,s){
      |     ^~~~
knapsack.cpp:264:19: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  264 |             if(cur>=item[i].size()) break;
      |                ~~~^~~~~~~~~~~~~~~~
knapsack.cpp:39:29: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   39 | #define FOR(a, b, c) for (ll(a) = (b); (a) < (c); ++(a))
      |                             ^
knapsack.cpp:45:19: note: in expansion of macro 'FOR'
   45 | #define rep(i, n) FOR(i, 0, n)
      |                   ^~~
knapsack.cpp:275:5: note: in expansion of macro 'rep'
  275 |     rep(i,s+1){
      |     ^~~
knapsack.cpp:39:29: warning: unnecessary parentheses in declaration of 'p' [-Wparentheses]
   39 | #define FOR(a, b, c) for (ll(a) = (b); (a) < (c); ++(a))
      |                             ^
knapsack.cpp:45:19: note: in expansion of macro 'FOR'
   45 | #define rep(i, n) FOR(i, 0, n)
      |                   ^~~
knapsack.cpp:276:9: note: in expansion of macro 'rep'
  276 |         rep(p,best[i].size()){
      |         ^~~
knapsack.cpp:39:44: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 | #define FOR(a, b, c) for (ll(a) = (b); (a) < (c); ++(a))
      |                                        ~~~~^~~~~
knapsack.cpp:45:19: note: in expansion of macro 'FOR'
   45 | #define rep(i, n) FOR(i, 0, n)
      |                   ^~~
knapsack.cpp:276:9: note: in expansion of macro 'rep'
  276 |         rep(p,best[i].size()){
      |         ^~~
knapsack.cpp:39:29: warning: unnecessary parentheses in declaration of 'w' [-Wparentheses]
   39 | #define FOR(a, b, c) for (ll(a) = (b); (a) < (c); ++(a))
      |                             ^
knapsack.cpp:45:19: note: in expansion of macro 'FOR'
   45 | #define rep(i, n) FOR(i, 0, n)
      |                   ^~~
knapsack.cpp:277:13: note: in expansion of macro 'rep'
  277 |             rep(w,s+1){
      |             ^~~
knapsack.cpp:39:29: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   39 | #define FOR(a, b, c) for (ll(a) = (b); (a) < (c); ++(a))
      |                             ^
knapsack.cpp:45:19: note: in expansion of macro 'FOR'
   45 | #define rep(i, n) FOR(i, 0, n)
      |                   ^~~
knapsack.cpp:284:5: note: in expansion of macro 'rep'
  284 |     rep(i,s+1) ans=max(ans,dp[i]);
      |     ^~~
knapsack.cpp:241:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  241 |         freopen("sort.in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
knapsack.cpp:242:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  242 |         freopen("sort.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...