답안 #68012

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
68012 2018-08-15T18:35:08 Z duality Skyscraper (JOI16_skyscraper) C++11
5 / 100
2000 ms 696 KB
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;

int A[100];
int main() {
    int i;
    int N,L;
    scanf("%d %d",&N,&L);
    for (i = 0; i < N; i++) scanf("%d",&A[i]);

    int ans = 0;
    sort(A,A+N);
    do {
        int s = 0;
        for (i = 1; i < N; i++) s += abs(A[i-1]-A[i]);
        if (s <= L) ans++;
    } while (next_permutation(A,A+N));
    printf("%d\n",ans);

    return 0;
}

Compilation message

skyscraper.cpp: In function 'int main()':
skyscraper.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&N,&L);
     ~~~~~^~~~~~~~~~~~~~~
skyscraper.cpp:14:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (i = 0; i < N; i++) scanf("%d",&A[i]);
                             ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 3 ms 572 KB Output is correct
5 Correct 3 ms 572 KB Output is correct
6 Correct 4 ms 572 KB Output is correct
7 Correct 4 ms 572 KB Output is correct
8 Correct 4 ms 696 KB Output is correct
9 Correct 4 ms 696 KB Output is correct
10 Correct 3 ms 696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2068 ms 696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 3 ms 572 KB Output is correct
5 Correct 3 ms 572 KB Output is correct
6 Correct 4 ms 572 KB Output is correct
7 Correct 4 ms 572 KB Output is correct
8 Correct 4 ms 696 KB Output is correct
9 Correct 4 ms 696 KB Output is correct
10 Correct 3 ms 696 KB Output is correct
11 Execution timed out 2068 ms 696 KB Time limit exceeded
12 Halted 0 ms 0 KB -