Submission #2885199


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/






int A[3];
//---------------------------------------------------------------------------------------------------
void _main() {
    rep(i, 0, 3) cin >> A[i];

    int ans = inf;

    vector<int> ord;
    rep(i, 0, 3) ord.push_back(i);
    do {
        int a = A[ord[0]], b = A[ord[1]], c = A[ord[2]];
        int ab = abs(a - b);
        int bc = abs(b - c);
        chmin(ans, ab + bc);
    } while (next_permutation(all(ord)));

    cout << ans << endl;
}

Submission Info

Submission Time
Task A - Task Scheduling Problem
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1725 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 13
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All 0_small_rand_0, 0_small_rand_1, 0_small_rand_2, 0_small_rand_3, 1_rand_0, 1_rand_1, 1_rand_2, 1_rand_3, 2_hand_0, 2_hand_1, sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
0_small_rand_0 AC 1 ms 256 KB
0_small_rand_1 AC 1 ms 256 KB
0_small_rand_2 AC 1 ms 256 KB
0_small_rand_3 AC 1 ms 256 KB
1_rand_0 AC 1 ms 256 KB
1_rand_1 AC 1 ms 256 KB
1_rand_2 AC 1 ms 256 KB
1_rand_3 AC 1 ms 256 KB
2_hand_0 AC 1 ms 256 KB
2_hand_1 AC 1 ms 256 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sample_03 AC 1 ms 256 KB