QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#415726 | #8708. Portal | vme50# | Compile Error | / | / | C++17 | 637b | 2024-05-21 09:09:35 | 2024-05-21 09:09:36 |
Judging History
This is the latest submission verdict.
- [2024-05-21 09:09:36]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-05-21 09:09:35]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lll __int128
#define pb push_back
const int N=1e5+5;
int n,a[N],b[N];lll p,x,y;
lll gcd(lll x,lll y) {return y?gcd(y,x%y):x;}
void wr(lll x) {if(x<10) {putchar(x+'0');return;}wr(x/10);putchar(x%10+'0');}
int main()
{
scanf("%d",&n);for(int i=1;i<=n;++i) scanf("%d %d",&a[i],&b[i]);
for(int i=1;i<n;++i) a[i]-=a[n],b[i]-=b[n];--n;x=a[n];y=b[n];
for(int i=1;i<n;++i)
{
lll x1=a[i],y1=b[i];
while(x1) {lll t=x/x1;x-=t*x1;y-=t*y1;if(p) y%=p;swap(x,x1);swap(y,y1);}
p=gcd(p,y1);
}if(!x || !p) printf("-1\n");else wr(abs(x*p));return 0;
}
详细
answer.code: In function ‘int main()’: answer.code:19:49: error: call of overloaded ‘abs(__int128)’ is ambiguous 19 | }if(!x || !p) printf("-1\n");else wr(abs(x*p));return 0; | ~~~^~~~~ In file included from /usr/include/c++/13/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:42, from answer.code:1: /usr/include/stdlib.h:840:12: note: candidate: ‘int abs(int)’ 840 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ In file included from /usr/include/c++/13/cstdlib:81: /usr/include/c++/13/bits/std_abs.h:79:3: note: candidate: ‘constexpr long double std::abs(long double)’ 79 | abs(long double __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:75:3: note: candidate: ‘constexpr float std::abs(float)’ 75 | abs(float __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:71:3: note: candidate: ‘constexpr double std::abs(double)’ 71 | abs(double __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:61:3: note: candidate: ‘long long int std::abs(long long int)’ 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/13/bits/std_abs.h:56:3: note: candidate: ‘long int std::abs(long int)’ 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ answer.code:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d",&n);for(int i=1;i<=n;++i) scanf("%d %d",&a[i],&b[i]); | ~~~~~^~~~~~~~~ answer.code:12:51: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d",&n);for(int i=1;i<=n;++i) scanf("%d %d",&a[i],&b[i]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~