Submission #200845

# Submission time Handle Problem Language Result Execution time Memory
200845 2020-02-08T10:04:51 Z quocnguyen1012 Fortune Telling 2 (JOI14_fortune_telling2) C++14
4 / 100
3000 ms 1528 KB
#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;

const int maxn = 2005;

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  if (fopen("A.INP", "r")){
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  }
  int n, m; cin >> n >> m;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i){
    cin >> a[i] >> b[i];
  }
  while (m--){
    int val; cin >> val;
    for (int i = 0; i < n; ++i){
      if (a[i] <= val){
        swap(a[i], b[i]);
      }
    }
  }
  ll sum = 0;
  for (int i = 0; i < n; ++i){
    sum += a[i];
  }
  cout << sum;
}

Compilation message

fortune_telling2.cpp: In function 'int main()':
fortune_telling2.cpp:17:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("A.INP", "r", stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
fortune_telling2.cpp:18:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("A.OUT", "w", stdout);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 9 ms 376 KB Output is correct
4 Correct 9 ms 376 KB Output is correct
5 Correct 9 ms 376 KB Output is correct
6 Correct 10 ms 376 KB Output is correct
7 Correct 9 ms 376 KB Output is correct
8 Correct 7 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 9 ms 376 KB Output is correct
12 Correct 9 ms 376 KB Output is correct
13 Correct 9 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 9 ms 376 KB Output is correct
4 Correct 9 ms 376 KB Output is correct
5 Correct 9 ms 376 KB Output is correct
6 Correct 10 ms 376 KB Output is correct
7 Correct 9 ms 376 KB Output is correct
8 Correct 7 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 9 ms 376 KB Output is correct
12 Correct 9 ms 376 KB Output is correct
13 Correct 9 ms 376 KB Output is correct
14 Correct 363 ms 760 KB Output is correct
15 Correct 1400 ms 1140 KB Output is correct
16 Execution timed out 3049 ms 1528 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 9 ms 376 KB Output is correct
4 Correct 9 ms 376 KB Output is correct
5 Correct 9 ms 376 KB Output is correct
6 Correct 10 ms 376 KB Output is correct
7 Correct 9 ms 376 KB Output is correct
8 Correct 7 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 9 ms 376 KB Output is correct
12 Correct 9 ms 376 KB Output is correct
13 Correct 9 ms 376 KB Output is correct
14 Correct 363 ms 760 KB Output is correct
15 Correct 1400 ms 1140 KB Output is correct
16 Execution timed out 3049 ms 1528 KB Time limit exceeded
17 Halted 0 ms 0 KB -