제출 #744813

#제출 시각아이디문제언어결과실행 시간메모리
744813jjcoderRainforest Jumps (APIO21_jumps)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include <cstdio>

using namespace std;
#define ll long long int
#define ull unsigned long long int
#define forn(a,b) for(int a=0; a<b; a++)
#define FOR(a,b) for(int a=1; a<=b; a++)
#define getmax(a,b) ((a)>(b)?(a):(b))
#define mp(a,b) make_pair(a,b)
#define vi vector<int>
#define vull vector<unsigned long long int>
#define vll vector<long long int>
#define vp vector<pair<int,int>>
#define vs vector<string>
#define pb push_back
#define s(a) sort(a.begin(),a.end())
#define sr(a) sort(a.rbegin(),a.rend())
#define INF 200000
int z=1e9+7;
int arr[20001],arr1[200010];

// find the number of digit in an integer : floor(log10(n))+1
/*vector<pair<int,int>>vec;
    vec.push_back({2,3});
    vec.push_back({3,2});
    sort(vec.rbegin(),vec.rend());
    cout << vec[0].first<<" "<<vec[0].second <<endl;
    cout << vec[1].first<<" "<<vec[1].second <<endl;
    */

/*for (auto it = v.begin(); it != v.end(); ++it) { // for map<ll,vector<ll>>qweqwe
    cout << "Key: " << it->first << ", Values: ";
    for (auto val : it->second) {
        cout << val << " ";
    }
    cout << endl;
}*/

/*for (auto& iter: s) { // for map<int,int>qweqwe
    	std::cout << iter.first << ": " << iter.second << std::endl;
  	}*/

int factorial(ull y)
{
    if(y<=1)return 1;
    else return y*factorial(y-1);
}
void setIO(string n)
{
    freopen((n+".in").c_str(),"r",stdin);
    freopen((n+".out").c_str(),"w",stdout);
}
void solve()
{
    int n,h;
    cin>>n>>h;
    vi a(n);
    forn(i,n)cin>>a[i];
    while(h--)
    {
       int A,B,C,D,min=200001;
       cin>>A>>B>>C>>D;
       for(int i=A; i<=B; i++){
        for(int j=C; j<=D;j++){
            int dist[j-i][j-i];
            FOR(p,j-i){
                dist[p][p]=0;
            }
            forn(k,j-i){
                for(int q=k+1; q<=j-i+1; q++){
                    if(a[q]>a[k]){
                        dist[k][q]=q-k;
                    }
                    else dist[k][q]=-1;
                }
            }
            for(int k=0; k<j-i; k++){
                for(int x=0; x<j-i; x++){
                    for(int y=0; y<j-i; y++){
                        if(dist[x][y]>dist[i][k]+dist[k][j]){
                            dist[x][y]=dist[i][k]+dist[k][j];
                            if(dist[x][y]<min && dist[x][y]!=0)min=dist[x][y];
                        }
                    }
                }
            }
        }
       }
       if(min<0)cout << -1 <<endl;
       else cout << min <<endl;
    }
}

int main()
{
    //setIO("input");
    ios::sync_with_stdio(0);
    solve();
    return 0;
}

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

jumps.cpp: In function 'void setIO(std::string)':
jumps.cpp:51:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |     freopen((n+".in").c_str(),"r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jumps.cpp:52:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |     freopen((n+".out").c_str(),"w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccJLF38E.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccoPzjUF.o:jumps.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccJLF38E.o: in function `main':
stub.cpp:(.text.startup+0x177): undefined reference to `init(int, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: stub.cpp:(.text.startup+0x1d1): undefined reference to `minimum_jumps(int, int, int, int)'
collect2: error: ld returned 1 exit status