답안 #871038

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
871038 2023-11-09T18:27:45 Z Ahmed57 NoM (RMI21_nom) C++17
9 / 100
500 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int>v;
    for(int i = 0;i<n;i++){
        v.push_back(i);v.push_back(i+n);
    }
    sort(v.begin(),v.end());
    long long ans = 0;
    do{
        int la[n]= {0};bool ss = 1;
        for(int i = 0;i<v.size();i++){
            if(la[v[i]%n]!=0){
                if(abs((i+1)-la[v[i]%n])%k==0){
                    ss = 0;
                    break;
                }
            }
            la[v[i]%n] = i+1;
        }
        if(ss)ans++;
    }while(next_permutation(v.begin(),v.end()));
    cout<<ans<<endl;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:16:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(int i = 0;i<v.size();i++){
      |                       ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 80 ms 432 KB Output is correct
10 Correct 218 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 80 ms 432 KB Output is correct
10 Correct 218 ms 428 KB Output is correct
11 Execution timed out 1035 ms 344 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 80 ms 432 KB Output is correct
10 Correct 218 ms 428 KB Output is correct
11 Execution timed out 1035 ms 344 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 80 ms 432 KB Output is correct
10 Correct 218 ms 428 KB Output is correct
11 Execution timed out 1035 ms 344 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 80 ms 432 KB Output is correct
10 Correct 218 ms 428 KB Output is correct
11 Execution timed out 1035 ms 344 KB Time limit exceeded
12 Halted 0 ms 0 KB -