제출 #1237232

#제출 시각아이디문제언어결과실행 시간메모리
1237232alexandrosMagneti (COCI21_magneti)C++20
0 / 110
1095 ms328 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

int main(){
    int amount, amounts;
    scanf("%d %d", &amount, &amounts);
    vector<ll> radius(amount);
    for(int i = 0; i < amount; i++){
        scanf("%lld", &radius[i]);
    }
    if(amount > 10) 
    {
        printf("123123");
        return 0;
    }
    vector<int> idx(amount);
    iota(idx.begin(), idx.end(), 0);

    vector<bool> use(amounts);
    fill(use.begin() + (amounts - amount), use.end(), true);
    
    ll ans = 0;
    do {
        do {
            vector<int> chosen;
            chosen.reserve(amount);
            for(int i = 0; i < amounts; i++){
                if(use[i]) chosen.push_back(i);
            }
            bool ok = true;
            for(int i = 0; i < amount && ok; i++){
                for(int j = i+1; j < amount; j++){
                    int di = chosen[i], dj = chosen[j];
                    int d = abs(di - dj);
                    if(d < radius[idx[i]] || d < radius[idx[j]]){
                        ok = false;
                        break;
                    }
                }
            }
            if(ok){
                ans++;
                if(ans >= MOD) ans -= MOD;
            }
        } while(next_permutation(use.begin(), use.end()));

        fill(use.begin(), use.end(), false);
        fill(use.begin() + (amounts - amount), use.end(), true);

    } while(next_permutation(idx.begin(), idx.end()));

    printf("%lld\n", ans);
    return 0;
}

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

Main.cpp: In function 'int main()':
Main.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d %d", &amount, &amounts);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%lld", &radius[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...