Submission #922496

#TimeUsernameProblemLanguageResultExecution timeMemory
922496elotelo966Growing Vegetable is Fun 3 (JOI19_ho_t3)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define OYY 100000005 #define mod 998244353 #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define mid (start+end)/2 #define lim 405 #define fi first #define se second int n;// 1 2 3 vector<int> v[4]; int dp[lim][lim][lim][4]; int gec[4][lim][4][lim];// renk index diğer index inline int dpp(int red,int gre,int yel,int sira,int renk){ if(sira>=n){ return 0; } if(~dp[red][gre][yel][renk])return dp[red][gre][yel][renk]; int yum=OYY; if(renk!=1 && red<v[1].size()){ int deg=0,deg2=0; if(gre>0)deg=gec[1][red][2][gre-1]; if(yel>0)deg2=gec[1][red][3][yel-1]; yum=min(yum,dpp(red+1,gre,yel,sira+1,1)+v[1][red]+deg+deg2-sira); } if(renk!=2 && gre<v[2].size()){ int deg=0,deg2=0; if(red>0)deg=gec[2][gre][1][red-1]; if(yel>0)deg2=gec[2][gre][3][yel-1]; yum=min(yum,dpp(red,gre+1,yel,sira+1,2)+v[2][gre]+deg+deg2-sira); } if(renk!=3 && yel<v[3].size()){ int deg=0,deg2=0; if(red>0)deg=gec[3][yel][1][red-1]; if(gre>0)deg2=gec[3][yel][2][gre-1]; yum=min(yum,dpp(red,gre,yel+1,sira+1,3)+v[3][yel]+deg+deg2-sira); } return dp[red][gre][yel][renk]=yum; } int32_t main(){ faster memset(dp,-1,sizeof(dp)); cin>>n; string s;cin>>s; for(int i=0;i<n;i++){ if(s[i]=='R')v[1].push_back(i); else if(s[i]=='G')v[2].push_back(i); else v[3].push_back(i); } for(int i=0;i<v[1].size();i++){ int tut=0; for(int j=0;j<v[2].size();j++){ if(v[1][i]<v[2][j])tut++; gec[1][i][2][j]=tut; } } for(int i=0;i<v[1].size();i++){ int tut=0; for(int j=0;j<v[3].size();j++){ if(v[1][i]<v[3][j])tut++; gec[1][i][3][j]=tut; } } for(int i=0;i<v[2].size();i++){ int tut=0; for(int j=0;j<v[1].size();j++){ if(v[2][i]<v[1][j])tut++; gec[2][i][1][j]=tut; } } for(int i=0;i<v[2].size();i++){ int tut=0; for(int j=0;j<v[3].size();j++){ if(v[2][i]<v[3][j])tut++; gec[2][i][3][j]=tut; } } for(int i=0;i<v[3].size();i++){ int tut=0; for(int j=0;j<v[1].size();j++){ if(v[3][i]<v[1][j])tut++; gec[3][i][1][j]=tut; } } for(int i=0;i<v[3].size();i++){ int tut=0; for(int j=0;j<v[2].size();j++){ if(v[3][i]<v[2][j])tut++; gec[3][i][2][j]=tut; } } string h=""; int deg=dpp(0,0,0,0,0); if(deg==OYY)deg=-1; cout<<deg<<'\n'; return 0; }

Compilation message (stderr)

joi2019_ho_t3.cpp: In function 'long long int dpp(long long int, long long int, long long int, long long int, long long int)':
joi2019_ho_t3.cpp:22:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  if(renk!=1 && red<v[1].size()){
      |                ~~~^~~~~~~~~~~~
joi2019_ho_t3.cpp:28:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  if(renk!=2 && gre<v[2].size()){
      |                ~~~^~~~~~~~~~~~
joi2019_ho_t3.cpp:34:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |  if(renk!=3 && yel<v[3].size()){
      |                ~~~^~~~~~~~~~~~
joi2019_ho_t3.cpp: In function 'int32_t main()':
joi2019_ho_t3.cpp:53:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |  for(int i=0;i<v[1].size();i++){
      |              ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:55:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |   for(int j=0;j<v[2].size();j++){
      |               ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:60:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |  for(int i=0;i<v[1].size();i++){
      |              ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:62:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |   for(int j=0;j<v[3].size();j++){
      |               ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:67:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |  for(int i=0;i<v[2].size();i++){
      |              ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:69:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |   for(int j=0;j<v[1].size();j++){
      |               ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:74:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |  for(int i=0;i<v[2].size();i++){
      |              ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:76:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |   for(int j=0;j<v[3].size();j++){
      |               ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:81:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   81 |  for(int i=0;i<v[3].size();i++){
      |              ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:83:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   83 |   for(int j=0;j<v[1].size();j++){
      |               ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:88:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   88 |  for(int i=0;i<v[3].size();i++){
      |              ~^~~~~~~~~~~~
joi2019_ho_t3.cpp:90:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   90 |   for(int j=0;j<v[2].size();j++){
      |               ~^~~~~~~~~~~~
/tmp/cc6uW6q6.o: in function `__tcf_0':
joi2019_ho_t3.cpp:(.text+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc6uW6q6.o
/tmp/cc6uW6q6.o: in function `dpp(long long, long long, long long, long long, long long)':
joi2019_ho_t3.cpp:(.text._Z3dppxxxxx[_Z3dppxxxxx]+0x18): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc6uW6q6.o
joi2019_ho_t3.cpp:(.text._Z3dppxxxxx[_Z3dppxxxxx]+0x6b): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc6uW6q6.o
joi2019_ho_t3.cpp:(.text._Z3dppxxxxx[_Z3dppxxxxx]+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc6uW6q6.o
joi2019_ho_t3.cpp:(.text._Z3dppxxxxx[_Z3dppxxxxx]+0xf2): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc6uW6q6.o
joi2019_ho_t3.cpp:(.text._Z3dppxxxxx[_Z3dppxxxxx]+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc6uW6q6.o
joi2019_ho_t3.cpp:(.text._Z3dppxxxxx[_Z3dppxxxxx]+0x13a): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc6uW6q6.o
joi2019_ho_t3.cpp:(.text._Z3dppxxxxx[_Z3dppxxxxx]+0x1b4): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc6uW6q6.o
joi2019_ho_t3.cpp:(.text._Z3dppxxxxx[_Z3dppxxxxx]+0x213): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc6uW6q6.o
joi2019_ho_t3.cpp:(.text._Z3dppxxxxx[_Z3dppxxxxx]+0x21a): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc6uW6q6.o
joi2019_ho_t3.cpp:(.text._Z3dppxxxxx[_Z3dppxxxxx]+0x294): 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