답안 #52114

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
52114 2018-06-24T04:10:09 Z hogogk(#1337) 운세 보기 2 (JOI14_fortune_telling2) C++11
4 / 100
11 ms 988 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool chk[1006];
int main()
{
    int a[1006],b[1006],nv[1006],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 252 KB Output is correct
2 Correct 6 ms 368 KB Output is correct
3 Correct 9 ms 576 KB Output is correct
4 Correct 8 ms 576 KB Output is correct
5 Correct 8 ms 576 KB Output is correct
6 Correct 8 ms 604 KB Output is correct
7 Correct 9 ms 648 KB Output is correct
8 Correct 5 ms 652 KB Output is correct
9 Correct 3 ms 672 KB Output is correct
10 Correct 4 ms 672 KB Output is correct
11 Correct 11 ms 856 KB Output is correct
12 Correct 11 ms 856 KB Output is correct
13 Correct 11 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 252 KB Output is correct
2 Correct 6 ms 368 KB Output is correct
3 Correct 9 ms 576 KB Output is correct
4 Correct 8 ms 576 KB Output is correct
5 Correct 8 ms 576 KB Output is correct
6 Correct 8 ms 604 KB Output is correct
7 Correct 9 ms 648 KB Output is correct
8 Correct 5 ms 652 KB Output is correct
9 Correct 3 ms 672 KB Output is correct
10 Correct 4 ms 672 KB Output is correct
11 Correct 11 ms 856 KB Output is correct
12 Correct 11 ms 856 KB Output is correct
13 Correct 11 ms 856 KB Output is correct
14 Runtime error 4 ms 988 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 252 KB Output is correct
2 Correct 6 ms 368 KB Output is correct
3 Correct 9 ms 576 KB Output is correct
4 Correct 8 ms 576 KB Output is correct
5 Correct 8 ms 576 KB Output is correct
6 Correct 8 ms 604 KB Output is correct
7 Correct 9 ms 648 KB Output is correct
8 Correct 5 ms 652 KB Output is correct
9 Correct 3 ms 672 KB Output is correct
10 Correct 4 ms 672 KB Output is correct
11 Correct 11 ms 856 KB Output is correct
12 Correct 11 ms 856 KB Output is correct
13 Correct 11 ms 856 KB Output is correct
14 Runtime error 4 ms 988 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Halted 0 ms 0 KB -