# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
143012 | 44442 | Go (COCI16_go) | C++11 | 3 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n,k[80],m[80],a[80],ok[80],b[80],c[80],e;
string s[80];
pair<int,int>p[80];
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n;
for(int i=0;i<n;i++){
cin>>s[i]>>k[i]>>m[i];
}
for(int i=0;i<n;i++){
a[i]=m[i]/k[i];
ok[i]=2*a[i]+(m[i]-(a[i]*k[i]));
while(ok[i]>=k[i]){
b[i]=ok[i];
ok[i]=ok[i]/k[i];
a[i]=a[i]+ok[i];
c[i]=ok[i];
ok[i]=ok[i]*2+(b[i]-(ok[i]*k[i]));
}
p[i]=make_pair(a[i],i);
e=e+a[i];
}
sort(p,p+n);
int i=n-1;
while(p[i].first==p[i-1].first){
i--;
}
cout<<e<<endl<<s[p[i].second];
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |