Submission #168675

# Submission time Handle Problem Language Result Execution time Memory
168675 2019-12-15T02:32:31 Z pr3pony Sticks (POI11_pat) C++14
100 / 100
264 ms 17964 KB
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define F first
#define S second
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int k;
    cin >> k;
    vector<pii> vp;
    for (int i = 0; i < k; ++i) {
        int w;
        cin >> w;
        for (int j = 0; j < w; ++j) {
            int l;
            cin >> l;
            vp.emplace_back(l, i + 1);
        }
    }
    sort(begin(vp), end(vp));
    deque<pii> dk;
    for (const auto & p : vp) {
        for (int i = 0; i < dk.size(); ++i)
            if (dk[i].S == p.S) {
                dk.erase(begin(dk) + i);
                break;
            }
        dk.push_front(p);
        if (dk.size() > 3)
            dk.pop_back();
        if (dk.size() == 3 && dk[1].F + dk[2].F > dk[0].F) {
            for (int i = 0; i < 3; ++i)
                cout << dk[i].S << ' ' << dk[i].F << " \n"[i == 2];
            return 0;
        }
    }
    cout << "NIE\n";
}

Compilation message

pat.cpp: In function 'int main()':
pat.cpp:25:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < dk.size(); ++i)
                         ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Oczekiwano NIE
2 Correct 9 ms 940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Oczekiwano NIE
2 Correct 11 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Oczekiwano NIE
2 Correct 26 ms 2292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 884 KB Oczekiwano NIE
2 Correct 39 ms 3824 KB Output is correct
3 Correct 28 ms 2296 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 19 ms 2164 KB Oczekiwano NIE
2 Correct 67 ms 6912 KB Output is correct
3 Correct 42 ms 3824 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 130 ms 9260 KB Output is correct
2 Correct 83 ms 7148 KB Output is correct
3 Correct 65 ms 4200 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 129 ms 9276 KB Output is correct
2 Correct 90 ms 7040 KB Output is correct
3 Correct 83 ms 6888 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 264 ms 17964 KB Output is correct
2 Correct 104 ms 7264 KB Output is correct
3 Correct 119 ms 7520 KB Oczekiwano NIE
# Verdict Execution time Memory Grader output
1 Correct 262 ms 17944 KB Output is correct
2 Correct 118 ms 8416 KB Output is correct
3 Correct 147 ms 13024 KB Oczekiwano NIE