답안 #381694

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381694 2021-03-25T17:01:14 Z mohamedsobhi777 운세 보기 2 (JOI14_fortune_telling2) C++14
4 / 100
3000 ms 1388 KB
#include <bits/stdc++.h>

using namespace std;

#define vi vector<int>
#define vll vector<ll>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define loop(_) for (int __ = 0; __ < (_); ++__)
#define pb push_back
#define f first
#define s second
#define sz(_) ((int)_.size())
#define all(_) _.begin(), _.end()
#define lb lower_bound
#define ub upper_bound

using ll = long long;
using ld = long double;

const int N = 1e5 + 7;
const ll mod = 1e9 + 7;

int n , k; 

int main()
{
       ios_base::sync_with_stdio(0);
       cin.tie(0);
#ifndef ONLINE_JUDGE
#endif
       cin >> n >> k ; 
       vii a(n) ; 
       for(auto &[x , y] : a)cin >> x >> y ;
       ll sum = 0 ; 
       for(int i = 0 ;i < n;++ i){
              sum += a[i].f ; 
       }
       while(k -- ){
              int x; cin >> x; 
              for(int i = 0 ;i < n;++ i){
                     if(a[i].f <= x){
                            sum -= a[i].f ; 
                            swap(a[i].f , a[i].s) ; 
                            sum += a[i].f ; 
                     }
              }
       }
       cout << sum ; 
       return 0;
}

Compilation message

fortune_telling2.cpp: In function 'int main()':
fortune_telling2.cpp:35:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   35 |        for(auto &[x , y] : a)cin >> x >> y ;
      |                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 6 ms 364 KB Output is correct
5 Correct 5 ms 364 KB Output is correct
6 Correct 5 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
8 Correct 3 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 6 ms 364 KB Output is correct
12 Correct 4 ms 364 KB Output is correct
13 Correct 4 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 6 ms 364 KB Output is correct
5 Correct 5 ms 364 KB Output is correct
6 Correct 5 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
8 Correct 3 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 6 ms 364 KB Output is correct
12 Correct 4 ms 364 KB Output is correct
13 Correct 4 ms 364 KB Output is correct
14 Correct 358 ms 876 KB Output is correct
15 Correct 1436 ms 1132 KB Output is correct
16 Execution timed out 3094 ms 1388 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 6 ms 364 KB Output is correct
5 Correct 5 ms 364 KB Output is correct
6 Correct 5 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
8 Correct 3 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 6 ms 364 KB Output is correct
12 Correct 4 ms 364 KB Output is correct
13 Correct 4 ms 364 KB Output is correct
14 Correct 358 ms 876 KB Output is correct
15 Correct 1436 ms 1132 KB Output is correct
16 Execution timed out 3094 ms 1388 KB Time limit exceeded
17 Halted 0 ms 0 KB -