제출 #740465

#제출 시각아이디문제언어결과실행 시간메모리
740465tolbi메기 농장 (IOI22_fish)C++17
0 / 100
1081 ms2097152 KiB
#pragma optimize("Bismillahirrahmanirrahim") //█▀█─█──█──█▀█─█─█ //█▄█─█──█──█▄█─█■█ //█─█─█▄─█▄─█─█─█─█ //Allahuekber //ahmet23 orz... //Sani buyuk Osman Pasa Plevneden cikmam diyor. //FatihSultanMehmedHan //YavuzSultanSelimHan //AbdulhamidHan #define author tolbi #include <bits/stdc++.h> #include "fish.h" using namespace std; template<typename X, typename Y> istream& operator>>(istream& in, pair<X,Y> &pr) {return in>>pr.first>>pr.second;} template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr) {return os<<pr.first<<" "<<pr.second;} template<typename X, typename Y> pair<X,Y> operator+(pair<X,Y> a, pair<X,Y> b) {pair<X,Y> c; c.first=a.first+b.first,c.second=a.second+b.second;return c;} template<typename X, typename Y> pair<X,Y> operator-(pair<X,Y> a, pair<X,Y> b) {pair<X,Y> c; c.first=a.first-b.first,c.second=a.second-b.second;return c;} template<typename X, typename Y> void operator+=(pair<X,Y> &a, pair<X,Y> b){a.first+=b.first,a.second+=b.second;} template<typename X, typename Y> void operator-=(pair<X,Y> &a, pair<X,Y> b){a.first-=b.first,a.second-=b.second;} template<typename X> istream& operator>>(istream& in, vector<X> &arr) {for(auto &it : arr) in>>it; return in;} template<typename X> ostream& operator<<(ostream& os, vector<X> arr) {for(auto &it : arr) os<<it<<" "; return os;} template<typename X, size_t Y> istream& operator>>(istream& in, array<X,Y> &arr) {for(auto &it : arr) in>>it; return in;} template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> arr) {for(auto &it : arr) os<<it<<" "; return os;} #define int long long #define endl '\n' #define vint(x) vector<int> x #define deci(x) int x;cin>>x; #define decstr(x) string x;cin>>x; #define cinarr(x) for (auto &it : x) cin>>it; #define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl; #define sortarr(x) sort(x.begin(),x.end()) #define sortrarr(x) sort(x.rbegin(),x.rend()) #define det(x) cout<<"NO\0YES"+x*3<<endl; #define INF LONG_LONG_MAX #define rev(x) reverse(x.begin(),x.end()); #define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define tol(bi) (1LL<<((int)(bi))) const int MOD = 1e9+7; mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count()); vector<vector<vector<int>>> dp; vector<vector<int>> we; int n; int f(int x, int lel1, int lel2){ if (dp[x][lel1][lel2]!=-1) return dp[x][lel1][lel2]; if (x==n) { int ans = 0ll; for (int i = lel2+1; i <= lel1; i++){ ans+=we[x-1][i]; } return dp[x][lel1][lel2]=ans; } int ans = 0ll; for (int i = 0; i <= n; i++){ int crcr = 0ll; for (int j = lel2+1; j <= max(i,lel1); j++){ crcr+=we[x-1][j]; } ans=max(ans,crcr+f(x+1,lel2,i)); } return dp[x][lel1][lel2]=ans; } long long max_weights(int32_t nn, int32_t m, vector<int32_t> x, vector<int32_t> y, vector<int32_t> w) { n=nn; dp.resize(n+1,vector<vector<int>>(n+1,vector<int>(n+1,-1))); we.resize(n+1,vector<int>(n+1,0)); for (int i = 0; i < m; i++){ we[x[i]][y[i]+1]=w[i]; } int ans = 0ll; for (int i = 0; i <= n; i++){ for (int j = 0; j <= n; j++){ int crr = 0ll; for (int z = i+1; z <= j; z++){ crr+=we[0][z]; } ans=max(ans,crr+f(2,i,j)); } } return ans; } #ifdef tolbi int32_t main(){ ios; int t=1; int tno = 0; if (!t) cin>>t; while (t-(tno++)){ int32_t n,m;cin>>n>>m; vector<int32_t> x(m),y(m),z(m); for (int i = 0; i < m; i++){ cin>>x[i]>>y[i]>>z[i]; } cout<<max_weights(n,m,x,y,z)<<endl; } } #endif

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

fish.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      |
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...