Submission #22284

#TimeUsernameProblemLanguageResultExecution timeMemory
22284퍼플달고싶다 (#40)Fully Generate (KRIII5_FG)C++14
2 / 7
500 ms495768 KiB
#include <bits/stdc++.h> #define pb push_back #define fi first #define se second #define SIZE 31600000 #define BC 50 #define BS 5000 #define MOD 1000000007LL #define MAXV 555 #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3fLL using namespace std; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef vector<vector<long long> > mat; ll n, cnt[SIZE], chk[SIZE]; ll getPow(ll a, ll p) { ll b = 1; while(p>0) { if(p%2LL) b*=a, b%=MOD; a*=a, p/=2LL, a%=MOD; } return b; } int main () { scanf("%lld",&n); ll pos = 1; chk[1] = 1, chk[2] = 2, chk[3] = 2; for(ll i=1;i<SIZE;i++) { for(ll j=0;j<chk[i] && j+pos<SIZE;j++) chk[j+pos] = i; pos += chk[i]; } // printf("pos %lld\n",pos); // for(int i=0;i<100;i++) printf("%lld ",chk[i]); ll p = 1, idx = 1, ret = 1; for(;p+chk[idx]<=n;) { // printf("p %lld idx %lld chkidx %lld\n",p,idx,chk[idx]); ret *= getPow(idx, chk[idx]), ret%=MOD; p += chk[idx]; idx++; } // printf("p %lld idx %lld\n",p,idx); if(p <= n+1LL) { // printf("getpow %lld\n",getPow(idx, n-p+1LL)); ret *= getPow(idx, n-p+1LL), ret%=MOD; } printf("%lld\n",ret); }

Compilation message (stderr)

FG.cpp: In function 'int main()':
FG.cpp:31:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...