제출 #633901

#제출 시각아이디문제언어결과실행 시간메모리
633901fadi57Gap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "gap.h" using namespace std; typedef long long ll; const ll inf =1e18; const ll mod=998244353; ll findGap(int N, int T){ ll mn=0; ll mx=inf; MinMax( 0, inf, &mn, &mx); ll st=mn;ll en=mx; ll len=(mx-(mn+1))/(n-1); vector<pair<ll,ll>>v; for(ll i=mn;<mx;i+=len){ MinMax( i, i+len-1, &mn, &mx); if(mn!=-1){ v.push_back({mn,mx}); } } ans=len; ans=max(ans,v[0].first-st);ans=max(ans,en-v[v.size()-1].second); for(int i=1;i<v.size();i++){ ans=max(ans,v[i].first-v[i-1].second); } return ans; } /* int main() { int t;//cin>>t; t=1; while(t--){ ll n,m;cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i]; } ll ans=0; for(int i=1;i<=n;i++){ if(a[i]!=a[i+1]){ ans+=(n-(i))*(i); same[i]=1; }else{ same[i]=0; } } ans+=(((n)*(n+1))/2); while(m--){ int x,y; cin>>x>>y; int ok=1; if(x<n){ ans-=same[x]*(n-(x))*(x); } if(x>1){ ans-=same[x-1]*(n-(x-1))*(x-1); } a[x]=y; if(x<n){ same[x]=(a[x]!=a[x+1]); } if(x>1){ same[x-1]=(a[x-1]!=a[x]); } if(x<n){ ans+=same[x]*(n-(x))*(x); } if(x>1){ ans+=same[x-1]*(n-(x-1))*(x-1); } cout<<ans<<"\n"; } // cout<<ans<<"\n"; } } */

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

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:12:21: error: 'n' was not declared in this scope; did you mean 'en'?
   12 | ll len=(mx-(mn+1))/(n-1);
      |                     ^
      |                     en
gap.cpp:14:13: error: expected primary-expression before '<' token
   14 | for(ll i=mn;<mx;i+=len){
      |             ^
gap.cpp:21:1: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 | ans=len;
      | ^~~
      | abs
gap.cpp:23:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 | for(int i=1;i<v.size();i++){
      |             ~^~~~~~~~~