Submission #52115

# Submission time Handle Problem Language Result Execution time Memory
52115 2018-06-24T04:11:10 Z hogogk(#1337) Fortune Telling 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);
                ~~~~~^~~~~~~~~
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -