Submission #1101123

#TimeUsernameProblemLanguageResultExecution timeMemory
1101123vjudge1로봇 (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef double db;
#define vc vector
#define vci vc<ll>
#define vcs vc<string>
#define pb push_back
#define ins insert
#define ii pair<ll,ll>
#define str to_string
#define fi first
#define se second
#define mii unordered_map<ll, ll>
#define len (ll)size

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	ll n;
	cin >> n;
	ll x, h;
	ll bef = INT_MIN, res = 0, px;
	while(n--) {
		cin >> x >> h;
		if(x - h > bef) bef = x, res++;
		else if(x > bef) bef = x + h, res++;
		else if(x - h > px) bef = x;
		else bef = x + h;
		px = x;
	}
	cout << res << endl;
    return 0;
}

Compilation message (stderr)

robots.cpp: In function 'int main()':
robots.cpp:28:8: warning: 'px' may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |   else if(x - h > px) bef = x;
      |        ^~
/usr/bin/ld: /tmp/ccIDejea.o: in function `main':
robots.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccjy6WC7.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccjy6WC7.o: in function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status