Submission #872911

#TimeUsernameProblemLanguageResultExecution timeMemory
872911vjudge1Climbers (RMI18_climbers)C++17
0 / 100
1 ms2516 KiB
#include <bits/stdc++.h> #define f first #define S second #define pb push_back #define msk(x , y) ((x >> y) & 1) #define all(x) x.begin() , x.end() using namespace std; typedef long long int ll; const int N = 2e5 + 7; const int mod = 1e9 + 7; const int dx[] = {-1,-1,1,1,2,-2,2,-2}; const int dy[] = {-2,2,2,-2,1,1,-1,-1}; ll n , a[N] , p[N] , s[N]; void solve(){ cin >> n ; ll ans = 0, pos = 0 , mx = 0 ; for(int i = 1 ; i <= n; i++){ cin >> a[i]; if(n != i) ans += abs(a[i] - a[i - 1]); } cout << ans << "\n"; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int test=1; // cin >> test ; for(int i=1;i<=test;i++){ // cout << "Case " << i << ": "; solve(); } }

Compilation message (stderr)

climbers.cpp: In function 'void solve()':
climbers.cpp:18:14: warning: unused variable 'pos' [-Wunused-variable]
   18 |  ll ans = 0, pos = 0 , mx = 0 ;
      |              ^~~
climbers.cpp:18:24: warning: unused variable 'mx' [-Wunused-variable]
   18 |  ll ans = 0, pos = 0 , mx = 0 ;
      |                        ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...