제출 #200845

#제출 시각아이디문제언어결과실행 시간메모리
200845quocnguyen1012운세 보기 2 (JOI14_fortune_telling2)C++14
4 / 100
3049 ms1528 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...