QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#711194 | #9241. Sphinx | ivan_alexeev# | Compile Error | / | / | C++23 | 2.5kb | 2024-11-05 01:44:39 | 2024-11-05 01:44:39 |
Judging History
This is the latest submission verdict.
- [2024-11-05 01:44:39]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-05 01:44:39]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll base = 1'000'000'000'000'000'000;
struct lox{
vector<ll> a;
void norm(){
while((a.size() > 1) && (a.back() == 0)){
a.pop_back();
}
}
};
lox operator+(const lox &a, const lox &b){
lox ans;
ans.a.resize(max(a.a.size(), b.a.size()) + 1);
int n = max(a.a.size(), b.a.size());
for(int i = 0; i < n; i++){
if(a.a.size() > i){
ans.a[i] += a.a[i];
}
if(b.a.size() > i){
ans.a[i] += b.a[i];
}
while(ans.a[i] >= base){
ans.a[i] -= base;
ans.a[i + 1]++;
}
}
ans.norm();
return ans;
}
lox operator-(const lox &a, const lox &b){
lox ans;
ans.a.resize(max(a.a.size(), b.a.size()));
int n = max(a.a.size(), b.a.size());
for(int i = 0; i < n; i++){
if(a.a.size() > i){
ans.a[i] += a.a[i];
}
if(b.a.size() > i){
ans.a[i] -= b.a[i];
}
while(ans.a[i] < 0){
ans.a[i] += base;
ans.a[i + 1]--;
}
}
ans.norm();
return ans;
}
bool operator<(const lox &a, const lox &b){
if(a.a.size() != b.a.size()){
return a.a.size() < b.a.size();
}else{
for(int i = a.a.size() - 1; i >= 0; i--){
if(a.a[i] != b.a[i]){
return a.a[i] < b.a[i];
}
}
return 0;
}
}
bool operator>(const lox &a, const lox &b){
return (b < a);
}
bool operator>=(const lox &a, const lox &b){
return !(a < b);
}
bool operator<=(const lox &a, const lox &b){
return (b >= a);
}
string s;
istream& operator >> (istream& in, lox &a) {
cin >> s;
std::reverse(s.begin(), s.end());
for(int i = 0; i < s.size(); i += 18){
string s1 = s.substr(i, 18);
std::reverse(s1.begin(), s1.end());
a.a.push_back(stoll(s1));
}
a.norm();
return in;
}
ostream& operator <<(ostream& out, lox &a){
for(auto i = a.a.rbegin(); i != a.a.rend(); i++){
if(i != a.a.rbegin()){
string s = to_string(base + *i);
cout << s.substr(1, s.size());
}else{
cout << *i;
}
}
return out;
}
signed main(){
int t;
cin >> t;
string s;
cin >> s;
cout << t << endl;
cout << s << "111" << endl;
return 0;
vector<lox> z(t);
lox a, b, c;
a = {{1}};
b = {{1}};
for(int i = 2; i < t; i++){
c = a + b;
a = b;
b = c;
}
cout << "1\n";
cout << b << endl;
}
Details
/usr/bin/ld: /tmp/ccyvfl6S.o: in function `main': answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccMfu0HS.o:implementer.cpp:(.text.startup+0x0): first defined here /usr/bin/ld: /tmp/ccMfu0HS.o: in function `main': implementer.cpp:(.text.startup+0x17f): undefined reference to `find_colours(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)' collect2: error: ld returned 1 exit status