QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#306775 | #5542. Doubled GCD | NYCU_CartesianTree# | Compile Error | / | / | C++20 | 946b | 2024-01-17 10:29:28 | 2024-01-17 10:29:29 |
Judging History
This is the latest submission verdict.
- [2024-01-17 10:29:29]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-01-17 10:29:28]
- Submitted
answer
//#include<bits/stdc++.h>
//using namespace std;
#define ing long long
#define F first
#define S second
#define pb push_back
int d(int t1){
int c1=0,c2=0;
while(t1%2==0) t1/=2,c1++;
return c1;
}
int gcd(int t1,int t2){
if(t2==0) return t1;
return gcd(t2,t1%t2);
}
void solve(){
int n;
cin>>n;
vector<int>a(n+1);
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<>>now;
for(int i=1;i<=n;i++) cin>>a[i],now.push({d(a[i]),a[i]});
// cout<<gcd(2000000000,2000000000)*2ll<<"\n";
while(now.size()>1){
auto t1=now.top();now.pop();
auto t2=now.top();now.pop();
// cerr<<t1.S<<" "<<t2.S<<"\n";
int v=gcd(t1.S,t2.S)*2ll;
// cerr<<v<<"\n";
int dd=d(v);
now.push({dd,v});
}
cout<<now.top().S<<"\n";
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);
solve();
return 0;
}
详细
answer.code: In function ‘void solve()’: answer.code:22:5: error: ‘cin’ was not declared in this scope 22 | cin>>n; | ^~~ answer.code:23:5: error: ‘vector’ was not declared in this scope 23 | vector<int>a(n+1); | ^~~~~~ answer.code:23:12: error: expected primary-expression before ‘int’ 23 | vector<int>a(n+1); | ^~~ answer.code:24:20: error: ‘pair’ was not declared in this scope 24 | priority_queue<pair<int,int>,vector<pair<int,int>>,greater<>>now; | ^~~~ answer.code:24:5: error: ‘priority_queue’ was not declared in this scope 24 | priority_queue<pair<int,int>,vector<pair<int,int>>,greater<>>now; | ^~~~~~~~~~~~~~ answer.code:24:25: error: expected primary-expression before ‘int’ 24 | priority_queue<pair<int,int>,vector<pair<int,int>>,greater<>>now; | ^~~ answer.code:25:32: error: ‘a’ was not declared in this scope 25 | for(int i=1;i<=n;i++) cin>>a[i],now.push({d(a[i]),a[i]}); | ^ answer.code:25:37: error: ‘now’ was not declared in this scope 25 | for(int i=1;i<=n;i++) cin>>a[i],now.push({d(a[i]),a[i]}); | ^~~ answer.code:28:11: error: ‘now’ was not declared in this scope 28 | while(now.size()>1){ | ^~~ answer.code:37:5: error: ‘cout’ was not declared in this scope 37 | cout<<now.top().S<<"\n"; | ^~~~ answer.code:37:11: error: ‘now’ was not declared in this scope 37 | cout<<now.top().S<<"\n"; | ^~~ answer.code: In function ‘int main()’: answer.code:41:5: error: ‘ios’ has not been declared 41 | ios::sync_with_stdio(0);cin.tie(0); | ^~~ answer.code:41:29: error: ‘cin’ was not declared in this scope 41 | ios::sync_with_stdio(0);cin.tie(0); | ^~~