Submission #86967

# Submission time Handle Problem Language Result Execution time Memory
86967 2018-11-29T02:26:59 Z FutymyClone Maja (COCI18_maja) C++14
0 / 110
2000 ms 33692 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 3005;

int n, m;
vector <pair <int, int> > vec;

int main(){
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        int x;
        scanf("%d", &x);
        vec.push_back({x, 1});
    }

    scanf("%d", &m);
    for (int i = 1; i <= m; i++) {
        int x;
        scanf("%d", &x);
        vec.push_back({x, 2});
    }

    sort(vec.begin(), vec.end());
    int ans = 0;
    for (auto i: vec) if (i.first <= 1440) ans++;
    printf("%d\n", ans);

    bool f1 = false, f2 = false;
    int cur1 = 0, cur2 = 0, res = 0;
    for (auto i: vec) {
        if (i.second == 1) {
            if (f2 && cur1 == cur2) res++, f2 = false;
            cur1++;

            if (cur1 > cur2) f1 = true;
        }
        else {
            if (f1 && cur2 == cur1) res++, f1 = false;
            cur2++;

            if (cur2 > cur1) f2 = true;
        }
    }
    printf("%d", res);
    return 0;
}

Compilation message

maja.cpp: In function 'int main()':
maja.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
maja.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &x);
         ~~~~~^~~~~~~~~~
maja.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &m);
     ~~~~~^~~~~~~~~~
maja.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &x);
         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2066 ms 33380 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2056 ms 33552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2072 ms 33552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2066 ms 33600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2060 ms 33620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2055 ms 33620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2061 ms 33620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2037 ms 33692 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2063 ms 33692 KB Time limit exceeded
2 Halted 0 ms 0 KB -