답안 #780589

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
780589 2023-07-12T10:34:50 Z vjudge1 Go (COCI18_go) C++17
컴파일 오류
0 ms 0 KB
int n,k,m;
vector<tuple<int,int,int>> pokemon;
ll int dp[3][2001][101][101];
ll int sagda(int ,int ,int ,int);
ll int solda(int nerden, int sn,int left,int right){

	if(sn>2000)return 0;
	int yedek=nerden;
	if(left<0||left>right)return 0;
	if(dp[nerden][sn][left][right]!=-1)return dp[nerden][sn][left][right];
	if(nerden==0)nerden=left-1;
	else if(nerden==1)nerden=right;
	else nerden=k;
	int e,d,f,x,y,z;
	if(nerden!=k)tie(f,d,e)=pokemon[nerden];
	else f=k;
	ll int ans=0,a=0,b=0;
	
	tie(x,y,z)=pokemon[left];	
	if(abs(x-f)+sn<z){
		a=y+solda(0,sn+abs(x-f),left-1,right);
		b=y+sagda(0,sn+abs(x-f),left,right+1);
		
	}
	else a=solda(0,sn+abs(x-f),left-1,right);
	//cout<<endl<<x<<" "<<y<<" "<<z<<" "<<f<<endl;
	//cout<<nerden<<" "<<yedek<<" a "<<sn<<" "<<left<<" "<<right<<" "<<a<<" "<<b<<endl;
	return dp[yedek][sn][left][right]=max(a,b);
}
ll int sagda(int nerden,int sn,int left,int right){
	if(sn>2000)return 0;
	int yedek=nerden;
	if(right>=m||left>right)return 0;
	if(dp[nerden][sn][left][right]!=-1&&nerden!=2)return dp[nerden][sn][left][right];
	if(nerden==0)nerden=left;
	else if(nerden==1)nerden=right-1;
	else nerden=k;
	int e,d,f,x,y,z;
	if(nerden!=k)tie(f,d,e)=pokemon[nerden];
	else f=k;
	ll int ans=0,a=0,b=0;
	tie(x,y,z)=pokemon[right];
	if(abs(x-f)+sn<z){
		a=y+sagda(1,sn+abs(x-f),left,right+1);
		b=y+solda(1,sn+abs(x-f),left-1,right);
		
	}
	else a=sagda(1,sn+abs(x-f),left,right+1);

	//cout<<endl<<x<<" "<<y<<" "<<z<<" "<<f<<endl;
	//cout<<nerden<<" "<<yedek<<" b "<<sn<<" "<<left<<" "<<right<<" "<<a<<" "<<b<<endl;
	return dp[yedek][sn][left][right]=max(a,b);
}
int main(){
	lalala;
	memset(dp,-1,sizeof(dp));
	int mm;cin>>n>>k>>mm;
	ll int cev=0;
	int le, rr;
	le=rr=-1;
	for(int i=0;i<mm;i++){
		ll int a,b,c;cin>>a>>b>>c;
		if(a==k){
			cev+=b;
			continue;
		}
		if(abs(k-a)<c){	
			pokemon.pb({a,b,c});
			if(a>k&&rr==-1)rr=m;
			else if(a<k)le=m;
			m++;
		}
	}
	if(rr==-1)rr=m+1;
	if(le==-1)le=-1;
	cout<<max(solda(2,0,le,rr-1),sagda(2,0,le,rr))+cev<<endl;



}

Compilation message

go.cpp:2:1: error: 'vector' does not name a type
    2 | vector<tuple<int,int,int>> pokemon;
      | ^~~~~~
go.cpp:3:1: error: 'll' does not name a type
    3 | ll int dp[3][2001][101][101];
      | ^~
go.cpp:4:1: error: 'll' does not name a type
    4 | ll int sagda(int ,int ,int ,int);
      | ^~
go.cpp:5:1: error: 'll' does not name a type
    5 | ll int solda(int nerden, int sn,int left,int right){
      | ^~
go.cpp:30:1: error: 'll' does not name a type
   30 | ll int sagda(int nerden,int sn,int left,int right){
      | ^~
go.cpp: In function 'int main()':
go.cpp:55:2: error: 'lalala' was not declared in this scope
   55 |  lalala;
      |  ^~~~~~
go.cpp:56:9: error: 'dp' was not declared in this scope
   56 |  memset(dp,-1,sizeof(dp));
      |         ^~
go.cpp:56:2: error: 'memset' was not declared in this scope
   56 |  memset(dp,-1,sizeof(dp));
      |  ^~~~~~
go.cpp:1:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
  +++ |+#include <cstring>
    1 | int n,k,m;
go.cpp:57:9: error: 'cin' was not declared in this scope
   57 |  int mm;cin>>n>>k>>mm;
      |         ^~~
go.cpp:58:2: error: 'll' was not declared in this scope
   58 |  ll int cev=0;
      |  ^~
go.cpp:62:5: error: expected ';' before 'int'
   62 |   ll int a,b,c;cin>>a>>b>>c;
      |     ^~~~
      |     ;
go.cpp:62:21: error: 'a' was not declared in this scope
   62 |   ll int a,b,c;cin>>a>>b>>c;
      |                     ^
go.cpp:62:24: error: 'b' was not declared in this scope
   62 |   ll int a,b,c;cin>>a>>b>>c;
      |                        ^
go.cpp:62:27: error: 'c' was not declared in this scope
   62 |   ll int a,b,c;cin>>a>>b>>c;
      |                           ^
go.cpp:64:4: error: 'cev' was not declared in this scope
   64 |    cev+=b;
      |    ^~~
go.cpp:67:6: error: 'abs' was not declared in this scope
   67 |   if(abs(k-a)<c){
      |      ^~~
go.cpp:68:4: error: 'pokemon' was not declared in this scope
   68 |    pokemon.pb({a,b,c});
      |    ^~~~~~~
go.cpp:76:2: error: 'cout' was not declared in this scope
   76 |  cout<<max(solda(2,0,le,rr-1),sagda(2,0,le,rr))+cev<<endl;
      |  ^~~~
go.cpp:76:12: error: 'solda' was not declared in this scope
   76 |  cout<<max(solda(2,0,le,rr-1),sagda(2,0,le,rr))+cev<<endl;
      |            ^~~~~
go.cpp:76:31: error: 'sagda' was not declared in this scope
   76 |  cout<<max(solda(2,0,le,rr-1),sagda(2,0,le,rr))+cev<<endl;
      |                               ^~~~~
go.cpp:76:8: error: 'max' was not declared in this scope
   76 |  cout<<max(solda(2,0,le,rr-1),sagda(2,0,le,rr))+cev<<endl;
      |        ^~~
go.cpp:76:49: error: 'cev' was not declared in this scope
   76 |  cout<<max(solda(2,0,le,rr-1),sagda(2,0,le,rr))+cev<<endl;
      |                                                 ^~~
go.cpp:76:54: error: 'endl' was not declared in this scope
   76 |  cout<<max(solda(2,0,le,rr-1),sagda(2,0,le,rr))+cev<<endl;
      |                                                      ^~~~