# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
22306 | | 크리님 제가 귀여우면 됬지 뭘 더 원하세요 진짜 (#40) | Fully Generate (KRIII5_FG) | C++14 | | 500 ms | 197864 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<list>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<functional>
#include<cmath>
#include<string>
#define sd(a) scanf("%d", &a);
#define sld(a) scanf("%lld", &a);
#define MOD 1000000007
using namespace std;
typedef long long int lli;
typedef pair<int, int> ii;
int xx[4] = { 0, 0, -1, 1 };
int yy[4] = { -1, 1, 0, 0 };
lli N;
lli cal(lli A, lli B) {
lli ret = 1;
while (B != 0) {
if (B % 2 == 0) {
A *= A;
A %= MOD;
B /= 2;
}
else {
ret *= A;
ret %= MOD;
B--;
}
}
return ret;
}
vector<lli> ve;
int main(void) {
sld(N);
ve.push_back(0);
ve.push_back(1);
ve.push_back(2);
ve.push_back(2);
if (N == 1) {
printf("1");
return 0;
}
else if (N == 2) {
printf("2");
return 0;
}
else if (N == 3) {
printf("4");
return 0;
}
else if (N == 4) {
printf("12");
return 0;
}
else if (N == 5) {
printf("36");
return 0;
}
lli ind = 3;
lli cur = ve[ind];
lli hap = 5;
lli ans = 36;
for (int i = 4; ; i++) {
if (cur == 0) {
ind++;
cur = ve[ind];
}
if (hap + ind >= N) {
break;
}
ans *= cal(ve.size(), ind);
ans %= MOD;
ve.push_back(ind);
hap += ind;
cur--;
}
ans *= cal(ve.size(), N - hap);
ans %= MOD;
printf("%lld", ans);
return 0;
}
Compilation message (stderr)
FG.cpp: In function 'int main()':
FG.cpp:17:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
#define sld(a) scanf("%lld", &a);
^
FG.cpp:49:2: note: in expansion of macro 'sld'
sld(N);
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |