답안 #287850

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
287850 2020-09-01T04:41:40 Z 반딧불(#5783) Skyscraper (JOI16_skyscraper) C++17
5 / 100
2000 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, l;
int arr[102];
int ans = 0;

int main(){
    scanf("%d %d", &n, &l);
    for(int i=1; i<=n; i++){
        scanf("%d", &arr[i]);
    }

    vector<int> v;
    for(int i=1; i<=n; i++) v.push_back(i);

    do {
        int tmp = 0;
        for(int i=1; i<n; i++) tmp += abs(arr[v[i]] - arr[v[i-1]]);
        if(tmp <= l) ans++;
    } while(next_permutation(v.begin(), v.end()));
    printf("%d", ans);
}

Compilation message

skyscraper.cpp: In function 'int main()':
skyscraper.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |     scanf("%d %d", &n, &l);
      |     ~~~~~^~~~~~~~~~~~~~~~~
skyscraper.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |         scanf("%d", &arr[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2074 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Execution timed out 2074 ms 256 KB Time limit exceeded
12 Halted 0 ms 0 KB -