Submission #38046911


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
//#define OPENIOBUF

namespace FastIO
{

class FastIOBase
{
 protected:
#ifdef OPENIOBUF
	static const int BUFSIZE=1<<22;
	char buf[BUFSIZE+1];
	int buf_p=0;
#endif
	FILE *target;
 public:
#ifdef OPENIOBUF
	virtual void flush()=0;
#endif
	FastIOBase(FILE *f): target(f){}
	~FastIOBase()=default;
};

class FastOutput: public FastIOBase
{
#ifdef OPENIOBUF
 public:
	inline void flush()
		{ fwrite(buf,1,buf_p,target),buf_p=0; }
#endif
 protected:
	inline void __putc(char x)
	{
#ifdef OPENIOBUF
		if(buf[buf_p++]=x,buf_p==BUFSIZE)flush();
#else
		putc(x,target);
#endif
	}
	template<typename T>
	inline void __write(T x)
	{
		static char stk[64],*top;top=stk;
		if(x<0) return __putc('-'),__write(-x);
		do *(top++)=x%10,x/=10; while(x);
		for(;top!=stk;__putc(*(--top)+'0'));
	}
 public:
	FastOutput(FILE *f=stdout): FastIOBase(f){}
#ifdef OPENIOBUF
	~FastOutput(){ flush(); }
#endif
	template<typename ...T>
	inline void writesp(const T &...x)
		{ initializer_list<int>{(this->operator<<(x),__putc(' '),0)...}; }
	template<typename ...T>
	inline void writeln(const T &...x)
		{ initializer_list<int>{(this->operator<<(x),__putc('\n'),0)...}; }
	inline FastOutput &operator <<(char x)
		{ return __putc(x),*this; }
	inline FastOutput &operator <<(const char *s)
		{ for(;*s;__putc(*(s++)));return *this; }
	inline FastOutput &operator <<(const string &s)
		{ return (*this)<<s.c_str(); }
	template<typename T,typename=typename enable_if<is_integral<T>::value>::type>
	inline FastOutput &operator <<(const T &x)
		{ return __write(x),*this; }
}qout;

class FastInput: public FastIOBase
{
#ifdef OPENIOBUF
 public:
	inline void flush()
		{ buf[fread(buf,1,BUFSIZE,target)]='\0',buf_p=0; }
#endif
 protected:
	inline char __getc()
	{
#ifdef OPENIOBUF
		if(buf_p==BUFSIZE) flush();
		return buf[buf_p++];
#else
		return getc(target);
#endif
	}
 public:
#ifdef OPENIOBUF
	FastInput(FILE *f=stdin): FastIOBase(f){ buf_p=BUFSIZE; }
#else
	FastInput(FILE *f=stdin): FastIOBase(f){}
#endif
	inline char getchar() { return __getc(); }
	template<typename ...T>
	inline void read(T &...x)
		{ initializer_list<int>{(this->operator>>(x),0)...}; }
	inline FastInput &operator >>(char &x)
		{ while(isspace(x=__getc()));return *this; }
	template<typename T,typename=typename enable_if<is_integral<T>::value>::type>
	inline FastInput &operator >>(T &x)
	{
		static char ch,sym;x=sym=0;
		while(isspace(ch=__getc()));
		if(ch=='-') sym=1,ch=__getc();
		for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=__getc());
		return sym?x=-x:x,*this;
	}
	inline FastInput &operator >>(char *s)
	{
		while(isspace(*s=__getc()));
		for(;!isspace(*s) && *s && ~*s;*(++s)=__getc());
		return *s='\0',*this;
	}
	inline FastInput &operator >>(string &s)
	{
		char str_buf[(1<<8)+1],*p=str_buf;
		char *const buf_end=str_buf+(1<<8);
		while(isspace(*p=__getc()));
		for(s.clear(),p++;;p=str_buf)
		{
			for(;p!=buf_end && !isspace(*p=__getc()) && *p && ~*p;p++);
			*p='\0',s.append(str_buf);
			if(p!=buf_end) break;
		}
		return *this;
	}
}qin;

} // namespace FastIO
using namespace FastIO;

using LL=long long;
using LD=long double;
using UI=unsigned int;
using ULL=unsigned long long;

#ifndef DADALZY
#define FILEIO(file) freopen(file".in","r",stdin),freopen(file".out","w",stdout)
#else
#define FILEIO(file)
#endif

char s[1000005];
LL n,ans;
int main()
{
	qin>>s,n=strlen(s);
	for(int i=0;i<n;i++) ans=ans*26+(s[i]-'A'+1);
	qout<<ans;
	return 0;
}

Submission Info

Submission Time
Task C - abc285_brutmhyhiizp
User balalida
Language C++ (GCC 9.2.1)
Score 300
Code Size 3612 Byte
Status AC
Exec Time 6 ms
Memory 3636 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 50
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt
Case Name Status Exec Time Memory
sample_01.txt AC 6 ms 3636 KiB
sample_02.txt AC 2 ms 3624 KiB
sample_03.txt AC 2 ms 3576 KiB
test_01.txt AC 2 ms 3564 KiB
test_02.txt AC 2 ms 3572 KiB
test_03.txt AC 2 ms 3508 KiB
test_04.txt AC 2 ms 3440 KiB
test_05.txt AC 2 ms 3568 KiB
test_06.txt AC 2 ms 3376 KiB
test_07.txt AC 2 ms 3576 KiB
test_08.txt AC 2 ms 3512 KiB
test_09.txt AC 2 ms 3380 KiB
test_10.txt AC 2 ms 3636 KiB
test_11.txt AC 2 ms 3440 KiB
test_12.txt AC 2 ms 3572 KiB
test_13.txt AC 2 ms 3440 KiB
test_14.txt AC 2 ms 3568 KiB
test_15.txt AC 2 ms 3436 KiB
test_16.txt AC 3 ms 3380 KiB
test_17.txt AC 2 ms 3512 KiB
test_18.txt AC 2 ms 3564 KiB
test_19.txt AC 2 ms 3584 KiB
test_20.txt AC 3 ms 3576 KiB
test_21.txt AC 2 ms 3524 KiB
test_22.txt AC 2 ms 3568 KiB
test_23.txt AC 2 ms 3524 KiB
test_24.txt AC 2 ms 3408 KiB
test_25.txt AC 2 ms 3376 KiB
test_26.txt AC 3 ms 3632 KiB
test_27.txt AC 2 ms 3576 KiB
test_28.txt AC 3 ms 3524 KiB
test_29.txt AC 2 ms 3548 KiB
test_30.txt AC 2 ms 3408 KiB
test_31.txt AC 2 ms 3432 KiB
test_32.txt AC 2 ms 3568 KiB
test_33.txt AC 3 ms 3512 KiB
test_34.txt AC 4 ms 3440 KiB
test_35.txt AC 2 ms 3580 KiB
test_36.txt AC 2 ms 3548 KiB
test_37.txt AC 2 ms 3576 KiB
test_38.txt AC 2 ms 3632 KiB
test_39.txt AC 2 ms 3412 KiB
test_40.txt AC 2 ms 3416 KiB
test_41.txt AC 2 ms 3408 KiB
test_42.txt AC 2 ms 3436 KiB
test_43.txt AC 2 ms 3436 KiB
test_44.txt AC 3 ms 3580 KiB
test_45.txt AC 2 ms 3568 KiB
test_46.txt AC 2 ms 3436 KiB
test_47.txt AC 2 ms 3568 KiB