Submission #1067959

# Submission time Handle Problem Language Result Execution time Memory
1067959 2024-08-21T06:09:29 Z 김은성(#11126) NoM (RMI21_nom) C++17
9 / 100
500 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1'000'000'007;
int main(){
	int n, m, i, j;
	ll mul = 1, ans = 0;
	scanf("%d %d", &n, &m);
	for(i=1; i<=n; i++)
		mul = (mul*2)%mod;
	vector<int> perm;
	for(i=1; i<=n; i++){
		perm.push_back(i);
		perm.push_back(i);
	}
	while(1){
		bool flag = 0;
		for(i=0; i<2*n; i++){
			for(j=i+m; j<2*n; j+=m){
				if(perm[i] == perm[j]){
					flag = 1; 
					break;
				}
			}
		}
		if(!flag)
			ans++;
		if(!next_permutation(perm.begin(), perm.end()))
			break;
	}
	printf("%lld\n", (mul*ans)%mod);
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%d %d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 0 ms 428 KB Output is correct
9 Correct 7 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 0 ms 428 KB Output is correct
9 Correct 7 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Execution timed out 1071 ms 432 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 0 ms 428 KB Output is correct
9 Correct 7 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Execution timed out 1071 ms 432 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 0 ms 428 KB Output is correct
9 Correct 7 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Execution timed out 1071 ms 432 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 512 KB Output is correct
8 Correct 0 ms 428 KB Output is correct
9 Correct 7 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Execution timed out 1071 ms 432 KB Time limit exceeded
12 Halted 0 ms 0 KB -