제출 #308132

#제출 시각아이디문제언어결과실행 시간메모리
308132juggernaut곤돌라 (IOI14_gondola)C++14
컴파일 에러
0 ms0 KiB
#include"gondola.h" #include<bits/stdc++.h> //#include"grader.cpp" using namespace std; typedef long long int ll; ll mod=1e9+7; int valid(int n,int a[]){ int i=0,need; while(i<n&&a[i]>n)i++; need=a[i]; while(i<n){ if(a[i]<=n&&a[i]!=need)return 0; if(need==n)need=1; else need++; i++; } sort(a,a+n); for(i=1;i<n;i++)if(a[i]==a[i-1])return 0; return 1; } int replacement(int n,int a[],int res[]){ vector<pair<int,int>>b; int i=0,ind=n,need=1,len=0,x; while(i<n&&a[i]>n)i++; if(i!=n)need=a[i]-i; if(need<1)need+=n; for(i=0;i<n;i++,need=need%n+1)b.push_back({a[i],need}); sort(b.begin(),b.end()); i=0; while(i<n){ if(b[i].first<=n){ i++; continue; } res[len++]=b[i].second; x=++ind; while(x!=b[i].first){ res[len++]=x; x=++ind; } i++; } return len; } int f(int x,int y) { if(y==0)return 1; if(y&1)return 1LL*x*pw(x,y-1)%mod; x=pw(x,y>>1); return 1LL*x*x%mod; } int countReplacement(int n, int inputSeq[]) { if(!valid(n,inputSeq))return 0; int i,r=1; sort(inputSeq,inputSeq+n); for(i=0;i<n;i++) { if(inputSeq[i]<=n)continue; r=1LL*r*pw(n-i,inputSeq[i]-(i>0?max(inputSeq[i-1],n):n)-1)%mod; } return 1LL*r*(inputSeq[0]>n?n:1)%mod; }

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

gondola.cpp: In function 'int f(int, int)':
gondola.cpp:48:23: error: 'pw' was not declared in this scope; did you mean 'pow'?
   48 |   if(y&1)return 1LL*x*pw(x,y-1)%mod;
      |                       ^~
      |                       pow
gondola.cpp:49:5: error: 'pw' was not declared in this scope; did you mean 'pow'?
   49 |   x=pw(x,y>>1);
      |     ^~
      |     pow
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:60:13: error: 'pw' was not declared in this scope; did you mean 'pow'?
   60 |     r=1LL*r*pw(n-i,inputSeq[i]-(i>0?max(inputSeq[i-1],n):n)-1)%mod;
      |             ^~
      |             pow