Submission #899656

# Submission time Handle Problem Language Result Execution time Memory
899656 2024-01-06T19:42:32 Z Karoot Ljeto (COCI21_ljeto) C++17
50 / 50
1 ms 604 KB
#include <iostream>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <iomanip>
#include <algorithm>

#define all(x)  (x).begin(), (x).end()
#define rall(x)  (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;

ll linf = 1e15+1;

inline void scoobydoobydoo(){
    ios::sync_with_stdio(false);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
}

vector<pair<int, int> > v[8];

int main(){
    scoobydoobydoo();
    int n; cin >> n;
    for (int i = 0; i < n; i++){
        int t, a, b; cin >> t >> a >> b;
        a--; b--;
        v[a].push_back({t, b});
    }

    int pineapple = 0, blueberries = 0;

    for (int i = 0; i < 4; i++){
        sort(all(v[i]));
        pineapple += v[i].size()*100;
        for (int j = 1; j < v[i].size(); j++)pineapple += (v[i][j].first <= v[i][j-1].first+10)*50;
    }

    for (int i = 4; i < 8; i++){
        sort(all(v[i]));
        blueberries += v[i].size()*100;
        for (int j = 1; j < v[i].size(); j++)blueberries += (v[i][j].first <= v[i][j-1].first+10)*50;
    }


    cout << pineapple << " " << blueberries << endl;


    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:43:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         for (int j = 1; j < v[i].size(); j++)pineapple += (v[i][j].first <= v[i][j-1].first+10)*50;
      |                         ~~^~~~~~~~~~~~~
Main.cpp:49:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         for (int j = 1; j < v[i].size(); j++)blueberries += (v[i][j].first <= v[i][j-1].first+10)*50;
      |                         ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 356 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct