Submission #717977

# Submission time Handle Problem Language Result Execution time Memory
717977 2023-04-03T04:01:40 Z vinnipuh01 Soccer (JOI17_soccer) C++17
5 / 100
1 ms 212 KB
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <map>
#include <queue>
#define int long long
#define sqrt sqrtl

using namespace std;

const long long oo = 1000000000000000000;

long long sum, ans = 0, mx = 0, mn = 1000000000, num, pos;


/*
    ViHHiPuh

   (( `'-""``""-'` ))
     )-__-_.._-__-(
   / --- (o _ o) --- \
   \ .-* ( .0. ) *-. /
   _'-. ,_ '=' _, .-'_
  / `;#'#'# - #'#'#;` \
 \_)) -----'#'----- ((_/
      # --------- #
  '# ------- ------ #'
  /..-'# ------- #'-.\
  _\...-\'# -- #'/-.../_
  ((____)- '#' -(____))


    cout << fixed << setprecision(6) << x;

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    freopen ( "sum.in", "r", stdin )
*/

int h, w, a, b, c, n, x[ 100001 ], y[ 100001 ];

main () {
	cin >> h >> w >> a >> b >> c >> n;
	for ( int i = 1;  i<= n; i ++ ) {
		cin >> x[ i ] >> y[ i ];
	}  
	if ( n == 2 ) {
		ans = abs( x[ 1 ] - x[ 2 ] ) + abs( y[ 1 ] - y[ 2 ] );
		ans = ans * c;
		ans = min( ans, abs( x[ 1 ] - x[  2] ) * c + a * abs( y[ 1 ] - y[ 2 ] ) + b );
		ans = min( ans, abs( y[  1] - y[ 2 ] ) * c + a * abs( x[  1] - x[ 2 ] ) + b );
		cout << ans;
	}
}

Compilation message

soccer.cpp:49:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   49 | main () {
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 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 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -