제출 #135350

#제출 시각아이디문제언어결과실행 시간메모리
135350Boxworld말 (IOI15_horses)C++14
0 / 100
1555 ms9408 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; struct year{int x,y;}a[500100]; string ans,ho; int n; int mod(string a){ long long tmp=0,big=1000000007; for (int i=0;i<a.length();i++){ tmp=tmp*10+int(a[i])-48; tmp%=big; } return tmp; } string mul(string sa,int b){ long long s[10010]; s[0]=sa.length(); for (int i=0;i<s[0];i++)s[s[0]-i]=((int)(sa[i])-48)*b; for (int i=1;i<s[0];i++){ s[i+1]+=s[i]/10; s[i]%=10; } while(s[s[0]]>=10){ s[s[0]+1]=s[s[0]]/10; s[s[0]]%=10; s[0]++; } while(s[s[0]]==0&&s[0]>1)s[0]--; string ss=""; for (int i=s[0];i>0;i--)ss+=char(s[i]+48); return ss; } int init(int N, int X[], int Y[]){ n=N; for (int i=0;i<n;i++){a[i].x=X[i];a[i].y=Y[i];} ho="1";ans="0"; for (int i=0;i<n;i++){ ho=mul(ho,a[i].x); string s=mul(ho,a[i].y); if (ans<s)ans=s; } return mod(ans); } int updateX(int pos, int val) { a[pos].x=val; ho="1";ans="0"; for (int i=0;i<n;i++){ ho=mul(ho,a[i].x); string s=mul(ho,a[i].y); if (ans<s)ans=s; } return mod(ans); } int updateY(int pos, int val) { a[pos].y=val; ho="1";ans="0"; for (int i=0;i<n;i++){ ho=mul(ho,a[i].x); string s=mul(ho,a[i].y); if (ans<s)ans=s; } return mod(ans); }

컴파일 시 표준 에러 (stderr) 메시지

horses.cpp: In function 'int mod(std::__cxx11::string)':
horses.cpp:7:17: warning: declaration of 'a' shadows a global declaration [-Wshadow]
 int mod(string a){
                 ^
horses.cpp:4:22: note: shadowed declaration is here
 struct year{int x,y;}a[500100];
                      ^
horses.cpp:9:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0;i<a.length();i++){
                  ~^~~~~~~~~~~
horses.cpp:13:12: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return tmp;
            ^~~
horses.cpp: In function 'std::__cxx11::string mul(std::__cxx11::string, int)':
horses.cpp:30:19: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     for (int i=s[0];i>0;i--)ss+=char(s[i]+48);
                ~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...