답안 #674654

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
674654 2022-12-25T15:51:14 Z vjudge1 Ljeto (COCI21_ljeto) C++17
50 / 50
1 ms 340 KB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("Ofast")
 
#define F first
#define S second
#define vi vector<int>
#define vvi vector<vi>
#define pi pair<int, int>
#define vpi vector<pi>
#define vb vector<bool>
#define vvb vector<vb>
#define pb push_back
#define ppb pop_back
#define read(a) for(auto &x:a) cin >> x;
#define print(a) for(auto x:a) cout << x << " "; cout << "\n";
#define vc vector<char>
#define vvc vector<vc>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

#define int long long
#define ld long double
const int INF = 4e18;

void solve(){
    int n; cin >> n;
    vvi v(8);
    int ans1 = 0, ans2 = 0;
    for(int i=0; i<n; i++){
        int t, a, b; cin >> t >> a >> b;
        v[a-1].pb(t);
    }

    for(int i=0; i<4; i++){
        sort(all(v[i]));
        for(int j=0; j<v[i].size(); j++){
            if(j > 0 && v[i][j]-v[i][j-1] <= 10) ans1 += 150;
            else ans1 += 100;
        }
    }
    for(int i=4; i<8; i++){
        sort(all(v[i]));
        for(int j=0; j<v[i].size(); j++){
            if(j > 0 && v[i][j]-v[i][j-1] <= 10) ans2 += 150;
            else ans2 += 100;
        }
    }
    cout << ans1 << " " << ans2 << "\n";
}

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

    // #ifndef ONLINE_JUDGE
    //     freopen("in.txt", "r", stdin);
    //     freopen("out.txt", "w", stdout);
    // #endif

    int tt = 1;
    // cin >> tt;
    while(tt--)
        solve();
    return 0;
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:37:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         for(int j=0; j<v[i].size(); j++){
      |                      ~^~~~~~~~~~~~
Main.cpp:44:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         for(int j=0; j<v[i].size(); j++){
      |                      ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 320 KB Output is correct
12 Correct 0 ms 320 KB Output is correct
13 Correct 1 ms 212 KB Output is correct