Submission #1015467

#TimeUsernameProblemLanguageResultExecution timeMemory
1015467asli_bgKnapsack (NOI18_knapsack)C++11
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define all(x) x.begin(),x.end() #define fi first #define se second #define int long long //tehlikeli #define pb push_back #define sp <<' '<< typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pii> vii; typedef vector<ll> vll; typedef vector<bool> vb; #define FOR(i,a) for(int i=0;i<(a);i++) #define FORE(i,a,b) for(int i=(a);i<(b);i++) #define RFOR(i,a) for(int i=(a);i>=0;i--) #define contp(a) for(auto el:a) {cout<<el.fi<<'-'<<el.se<<' ';}cout<<endl #define cont(a) for(auto el:a) {cout<<el<<' ';}cout<<endl const int MAXN=1e6+1; const int MAXS=2005; const int INF=1e13+3; int dp[MAXS]; int say[MAXS][MAXN]; bool mycmp(pii a,pii b){ return a.fi>b.fi; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n,mxw; cin>>mxw>>n; vi v(n+1); vi w(n+1); vi k(n+1); FOR(i,n){ cin>>v[i+1]>>w[i+1]>>k[i+1]; } FORE(i,1,n+1){ say[0][i]=k[i]; } FORE(i,1,mxw+1){ int ind=0; dp[i]=dp[i-1]; FORE(j,1,n+1){ if(i-w[j]>=0 and say[i-w[j]][j]>0 and dp[i-w[j]]+v[j]>dp[i]){ //kullan dp[i]=dp[i-w[j]]+v[j]; ind=j; } } if(ind){ FORE(j,1,n+1){ say[i][j]=say[i-w[ind]][j]; //i.weightte j.elemandan kaç tane kaldi if(j==ind) say[i][j]--; } } else{ FORE(j,1,n+1) say[i][j]=say[i-1][j]; } } cout<<dp[mxw]<<endl; }

Compilation message (stderr)

/tmp/ccKUpu9M.o: in function `main':
knapsack.cpp:(.text.startup+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
knapsack.cpp:(.text.startup+0x43): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
knapsack.cpp:(.text.startup+0xa4): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
knapsack.cpp:(.text.startup+0x165): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccKUpu9M.o
knapsack.cpp:(.text.startup+0x1ad): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccKUpu9M.o
knapsack.cpp:(.text.startup+0x25f): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccKUpu9M.o
knapsack.cpp:(.text.startup+0x266): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
/tmp/ccKUpu9M.o: in function `_GLOBAL__sub_I_dp':
knapsack.cpp:(.text.startup+0x39b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
knapsack.cpp:(.text.startup+0x3b9): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1e): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2b): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status