제출 #1070430

#제출 시각아이디문제언어결과실행 시간메모리
1070430Malix추월 (IOI23_overtaking)C++17
컴파일 에러
0 ms0 KiB
#include "overtaking.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;
typedef vector<ll> li;
typedef vector<li> lii;
 
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define PB push_back
#define MP make_pair
#define LSOne(s) ((s)&(-s))
 
ll INF=1000000000000000010;
int inf=1e9+10;

vector<ll> arr,tm;
vector<int> sz,w;
ll k;
int n,m;

void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S)
{
    n=N;m=M;
    k=(ll)X;
    sz=S;
    tm=T;
    w=W;
    arr.resize(m);
    if(n==1){
        REP(i,0,m)arr[i]=T[0]+(ll)W[0]*(ll)S[i];
        return;
    }

    return;
}

long long arrival_time(long long Y)
{
if(n==1){
    ll ans=Y+(ll)sz[m-1]*k;
    REP(i,1,m)if(arr[i]>=Y+(ll)k*sz[i]&&arr[i-1]<Y+(ll)k*sz[i-1]){
        ans=arr[i]+k*(ll)(sz[m-1]-sz[i]);
        return ans;
    }
    return ans;
}
    ll ans=Y+(ll)sz[m-1]*k;
    REP(i,0,n){
        if(tm[i]>=Y)break;
        ans=max(ans,tm[i]+sz[m-1]*w[i]);
    }
    return ans;
}

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

overtaking.cpp: In function 'void init(int, int, std::vector<long long int>, std::vector<int>, int, int, std::vector<int>)':
overtaking.cpp:33:5: error: reference to 'tm' is ambiguous
   33 |     tm=T;
      |     ^~
In file included from /usr/include/time.h:39,
                 from /usr/include/c++/10/ctime:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:49,
                 from overtaking.cpp:2:
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
overtaking.cpp:23:16: note:                 'std::vector<long long int> tm'
   23 | vector<ll> arr,tm;
      |                ^~
overtaking.cpp: In function 'long long int arrival_time(long long int)':
overtaking.cpp:56:12: error: reference to 'tm' is ambiguous
   56 |         if(tm[i]>=Y)break;
      |            ^~
In file included from /usr/include/time.h:39,
                 from /usr/include/c++/10/ctime:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:49,
                 from overtaking.cpp:2:
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
overtaking.cpp:23:16: note:                 'std::vector<long long int> tm'
   23 | vector<ll> arr,tm;
      |                ^~
overtaking.cpp:57:21: error: reference to 'tm' is ambiguous
   57 |         ans=max(ans,tm[i]+sz[m-1]*w[i]);
      |                     ^~
In file included from /usr/include/time.h:39,
                 from /usr/include/c++/10/ctime:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:49,
                 from overtaking.cpp:2:
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
overtaking.cpp:23:16: note:                 'std::vector<long long int> tm'
   23 | vector<ll> arr,tm;
      |                ^~