제출 #120551

#제출 시각아이디문제언어결과실행 시간메모리
120551_SamirGo (COCI18_go)C++14
0 / 100
134 ms173816 KiB
//https://github.com/mostafa-saad/MyCompetitiveProgramming/blob/master/Olympiad/MCO/official/2016/editorial.pdf #include<queue> #include<map> #include <string> #include<bits/stdc++.h> #define pi 3.141592654 #define forr(i,a,b) for(int i=a;i<=b;i++) #define F first #define S second #define input ios_base::sync_with_stdio(0);cin.tie(0); //#define x real() //#define y imag() using namespace std; typedef pair<double,double>pdd; typedef long long ll; typedef pair<ll, ll>pii; //typedef complex<double> point; //template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); } //typedef bitset<30> mask; //int x[8]={1,0,0,-1,-1,-1,1,1}; //int y[8]={0,1,-1,0,-1,1,-1,1}; //#define var(x) ((x)<<1) //#define nvar(x) ((x)^1) const int N=100000,M=100000; int n,m,k,p[110],w[110],e[110],mem[105][105][2][2009]; int dp(int l,int r,int ck,int t) { if(l<1||r>m)return 0; if(ck==0&&e[l]<=t)return 0; if(ck==1&&e[r]<=t)return 0; int&ret=mem[l][r][ck][t]; if(~ret)return ret; ret=0; if(!ck) { ret=max(ret,dp(l-1,r,0,abs(p[l]-p[l-1])+t)+w[l]); ret=max(ret,dp(l,r+1,1,abs(p[l]-p[r+1])+t)+w[l]); } else { ret=max(ret,dp(l-1,r,0,abs(p[r]-p[l-1])+t)+w[r]); ret=max(ret,dp(l,r+1,1,abs(p[r]-p[r+1])+t)+w[r]); } return ret; } main() { //cout<<Pow((ll)1000000,(ll)110); //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); // char input[15]; // scanf("%s", &input); array of char // gets(c+1); array of char //printf("%s, ",name[k[i]].c_str()); printf of string //priority_queue<ll,vector<ll>,greater<ll>>y; input; cin>>n>>k>>m; forr(i,1,m) cin>>p[i]>>w[i]>>e[i]; p[m+1]=n+100; memset(mem,-1,sizeof mem); int ans=0; forr(i,1,m) ans=max(ans,dp(i,i,0,abs(p[i]-k))); cout<<ans<<endl; return 0; }

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

go.cpp:50:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  main()
       ^
#Verdict Execution timeMemoryGrader output
Fetching results...