Submission #151629

#TimeUsernameProblemLanguageResultExecution timeMemory
151629shdutList of Unique Integers (FXCUP4_unique)C++17
Compilation error
0 ms0 KiB
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <algorithm>
#include <assert.h>

using namespace std;

#define rep(i, a, b) for(int i = a; i < b; i++)
#define per(i, a, b) for(int i = b - 1; i >= a; i--)
#define ll long long
#define x first
#define y second
#define vi vector<int>
#define pii pair<int, int>
#define SZ(x) (int)(x.size())
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define mod 1000000007
#define inf 1000000007
#define DBG(x) cerr << (#x) << "=" << x << "\n";

#define N 100005

template<typename U, typename V> void Min(U &a, const V &b){if(a > b) a = b;}
template<typename U, typename V> void Max(U &a, const V &b){if(a < b) a = b;}
template<typename U, typename V> void add(U &a, const V &b){a = (a+b) % mod;}

ll a, b, c, d, mi, mx;
string ans;
void go(ll x, ll y, string s){
	if(x == a && y == b){
		ans = min(ans, s);
		return;
	}	
	if((x+y)%2 || min(x, y) > mi || max(x, y) < mx)return;
	go(x, (x+y)/2, "A" + s);
	go((x+y)/2, y, "B" + s);
}
int main(){
    int T, n, K, m, k, j;
	scanf("%d", &T);
	string s;
	while(T--){
		scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
		ans = "C";
		s = "";
		mi = min(a, b);
		mx = max(a, b);
		go(c, d, s);
		if(ans[0] != 'C'){
			puts("Yes");
			puts(ans.c_str());
		}
		else puts("No");
	}
}

Compilation message (stderr)

unique.cpp: In function 'int main()':
unique.cpp:47:12: warning: unused variable 'n' [-Wunused-variable]
     int T, n, K, m, k, j;
            ^
unique.cpp:47:15: warning: unused variable 'K' [-Wunused-variable]
     int T, n, K, m, k, j;
               ^
unique.cpp:47:18: warning: unused variable 'm' [-Wunused-variable]
     int T, n, K, m, k, j;
                  ^
unique.cpp:47:21: warning: unused variable 'k' [-Wunused-variable]
     int T, n, K, m, k, j;
                     ^
unique.cpp:47:24: warning: unused variable 'j' [-Wunused-variable]
     int T, n, K, m, k, j;
                        ^
unique.cpp:48:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &T);
  ~~~~~^~~~~~~~~~
unique.cpp:51:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ccsRogm7.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccv13TKq.o:unique.cpp:(.text.startup+0x0): first defined here
/tmp/ccsRogm7.o: In function `main':
grader.cpp:(.text.startup+0x190): undefined reference to `PickUnique(int)'
collect2: error: ld returned 1 exit status