답안 #52115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
52115 2018-06-24T04:11:10 Z hogogk(#1337) 운세 보기 2 (JOI14_fortune_telling2) C++11
4 / 100
2000 ms 1624 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool chk[100006];
int main()
{
    int a[100006],b[100006],nv[100006],m,n;
    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++) scanf("%d %d",&a[i],&b[i]),nv[i]=a[i];
    for(int i=0;i<m;i++) {
        int k; scanf("%d",&k);
        for(int j=0;j<n;j++) {
            if(nv[j]<=k)
            {
                if(chk[j]) chk[j]=false,nv[j]=a[j];
                else nv[j]=b[j],chk[j]=true;
            }
        }
    }
    ll sum=0;
    for(int i=0;i<n;i++) sum+=nv[i];
    return !printf("%lld",sum);
}

Compilation message

fortune_telling2.cpp: In function 'int main()':
fortune_telling2.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~~
fortune_telling2.cpp:9:52: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++) scanf("%d %d",&a[i],&b[i]),nv[i]=a[i];
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
fortune_telling2.cpp:11:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int k; scanf("%d",&k);
                ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 6 ms 456 KB Output is correct
3 Correct 9 ms 456 KB Output is correct
4 Correct 9 ms 456 KB Output is correct
5 Correct 9 ms 456 KB Output is correct
6 Correct 8 ms 456 KB Output is correct
7 Correct 10 ms 460 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 4 ms 512 KB Output is correct
11 Correct 9 ms 512 KB Output is correct
12 Correct 11 ms 512 KB Output is correct
13 Correct 9 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 6 ms 456 KB Output is correct
3 Correct 9 ms 456 KB Output is correct
4 Correct 9 ms 456 KB Output is correct
5 Correct 9 ms 456 KB Output is correct
6 Correct 8 ms 456 KB Output is correct
7 Correct 10 ms 460 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 4 ms 512 KB Output is correct
11 Correct 9 ms 512 KB Output is correct
12 Correct 11 ms 512 KB Output is correct
13 Correct 9 ms 512 KB Output is correct
14 Correct 588 ms 860 KB Output is correct
15 Execution timed out 2067 ms 1624 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 6 ms 456 KB Output is correct
3 Correct 9 ms 456 KB Output is correct
4 Correct 9 ms 456 KB Output is correct
5 Correct 9 ms 456 KB Output is correct
6 Correct 8 ms 456 KB Output is correct
7 Correct 10 ms 460 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 4 ms 512 KB Output is correct
11 Correct 9 ms 512 KB Output is correct
12 Correct 11 ms 512 KB Output is correct
13 Correct 9 ms 512 KB Output is correct
14 Correct 588 ms 860 KB Output is correct
15 Execution timed out 2067 ms 1624 KB Time limit exceeded
16 Halted 0 ms 0 KB -