Submission #289051

#TimeUsernameProblemLanguageResultExecution timeMemory
289051SamAndWiring (IOI17_wiring)C++17
0 / 100
1 ms256 KiB
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
const int N = 100005;

ll ans;
int n, m;

long long min_total_length(std::vector<int> r, std::vector<int> b)
{
    n = sz(r);
    m = sz(b);
    for (int i = 0; i < n; ++i)
    {
        ans -= r[i];
    }
    for (int i = 0; i < m; ++i)
    {
        ans += b[i];
    }
    for (int i = 0; i < n - m; ++i)
        ans -= r[n - 1];
    for (int i = 0; i < m - n; ++i)
        ans += b[0];
	return ans;
}

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:29:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   29 |     for (int i = 0; i < m - n; ++i)
      |     ^~~
wiring.cpp:31:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   31 |  return ans;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...