Submission #228939

# Submission time Handle Problem Language Result Execution time Memory
228939 2020-05-03T06:25:03 Z NONAME Preokret (COCI18_preokret) C++17
0.3 / 50
6 ms 384 KB
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 100500
#define oo ll(1e16)
#define ft first
#define sd second
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;
typedef long long ll;
typedef long double ld;

int n, res1, res2, cnt[2];
vector <pair <int, bool> > v;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    in("input.txt");

    cin >> n;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        v.pb({x, 0});
    }

    cin >> n;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        v.pb({x, 1});
    }

    sort(v.begin(), v.end());

    n = sz(v);

    for (int i = 0; i < n; i++) {
        int t = v[i].sd;

        if (v[i].ft <= 24 * 60)
            res1++;

        if (cnt[t] < cnt[t ^ 1] && cnt[t] + 2 > cnt[t ^ 1] && i + 1 < n && v[i + 1].sd == t)
            res2++;

        cnt[t]++;
    }

    cout << res1 << el << res2;
}

Compilation message

preokret.cpp: In function 'int main()':
preokret.cpp:3:22: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
 #define in(x) freopen(x, "r", stdin)
               ~~~~~~~^~~~~~~~~~~~~~~
preokret.cpp:24:5: note: in expansion of macro 'in'
     in("input.txt");
     ^~
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Incorrect 6 ms 384 KB Output isn't correct
3 Incorrect 6 ms 384 KB Output isn't correct
4 Incorrect 6 ms 384 KB Output isn't correct
5 Incorrect 6 ms 384 KB Output isn't correct
6 Incorrect 6 ms 384 KB Output isn't correct
7 Incorrect 6 ms 384 KB Output isn't correct
8 Incorrect 6 ms 384 KB Output isn't correct
9 Incorrect 6 ms 384 KB Output isn't correct
10 Partially correct 6 ms 384 KB Output is partially correct