Submission #60727355


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define re register
#define il inline
#define pii pair<int,int>
#define x first
#define y second
#define gc getchar()
#define rd read()
#define debug() puts("------------")
namespace yzqwq{
il int read(){
int x=0,f=1;char ch=gc;
while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=gc;}
while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=gc;
return x*f;
}
il int qmi(int a,int b,int p){
int ans=1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define re register
#define il inline
#define pii pair<int,int>
#define x first
#define y second
#define gc getchar()
#define rd read()
#define debug() puts("------------")

namespace yzqwq{
    il int read(){
        int x=0,f=1;char ch=gc;
        while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=gc;}
        while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=gc;
        return x*f;
    }
    il int qmi(int a,int b,int p){
        int ans=1;
        while(b){
            if(b&1) ans=ans*a%p;
            a=a*a%p,b>>=1;
        }
        return ans;
    }
    il int gcd(int a,int b){
        if(!b) return a;
        return gcd(b,a%b);
    }
    il int lcm(int a,int b){
        return a/gcd(a,b)*b;
    }
    il void exgcd(int a,int b,int &x,int &y){
        if(!b) return x=1,y=0,void(0);
        exgcd(b,a%b,x,y);
        int t=x;
        x=y,y=t-a/b*x;
        return ;
    }
    il int F(int n,int a,int b,int c){
        //sum{|_ (ai+b)/c _| i:0~n}
        if(!n) return b/c;
        if(!a) return (n+1)*(b/c);
        if(a>=c||b>=c){
            int x=a/b,y=b/c;
            return n*(n+1)/2*x+(n+1)*y+F(n,a%c,b%c,c);
        }
        int m=(a*n+b)/c;
        return n*m+F(m-1,c,c-b+1,a);
    }
    struct lb{
        int d[64];
        il void print(){
            for(re int i=0;i<63;++i)
            if(d[i]) printf("%lld:%lld\n",i,d[i]);
            return ;
        }
        lb(){memset(d,0,sizeof(d));}
        il void operator +=(int x){
            for(re int i=62;i>=0;--i){
                if(!(x&(1ll<<i))) continue;
                if(d[i]) x^=d[i];
                else return d[i]=x,void(0);
            }
            return ;
        }
        int& operator [](int x){
            return d[x];
        }
        il void operator +=(lb &x){
            for(re int i=62;i>=0;--i)
            if(x[i]) *this+=x[i];
            return ;
        }
        il friend lb operator +(lb &x,lb &y){
            lb z=x;
            for(re int i=62;i>=0;--i)
            if(y[i]) z+=y[i];
            return z;
        }
        il int Max_calc(){
            int ans=0;
            for(re int i=62;i>=0;--i)
            if((ans^d[i])>ans) ans^=d[i];
            return ans;
        }
    };
    mt19937 rnd(time(0));
}
using namespace yzqwq;

const int N=1e6+10;
int val[N];
struct node{
	string s;
	int val;
	il bool operator<(const node&b)const{
		if(val!=b.val) return val>b.val;
		return s<b.s;
	}
}a[N];
int idx;

il int get(string s){
	int sum=0;
	for(re int i=0;i<s.size();++i){
		sum+=val[s[i]-'A'];
	}
	return sum;
	
}
il void dfs(string s,int now){
	if(now>4){
		a[++idx].val=get(s);
		a[idx].s=s;
		return ;
	}
	dfs(s,now+1);
	string w=s;
	char ch='A'+now;
	w+=ch;
	dfs(w,now+1);
	return ; 
}

il void solve(){
	for(re int i=0;i<5;++i) val[i]=rd;
	dfs("",0);
	sort(a+1,a+idx+1);
	for(re int i=1;i<idx;++i) cout<<a[i].s<<"\n";
    return ;
}

signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    int t=1;while(t--)
    solve();
    return 0;
}

Submission Info

Submission Time
Task C - Perfect Standings
User fzitb7912
Language C++ 20 (gcc 12.2)
Score 300
Code Size 3201 Byte
Status AC
Exec Time 19 ms
Memory 42704 KB

Compile Error

Main.cpp: In member function ‘void yzqwq::lb::print()’:
Main.cpp:56:24: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   56 |             for(re int i=0;i<63;++i)
      |                        ^
Main.cpp: In member function ‘void yzqwq::lb::operator+=(long long int)’:
Main.cpp:62:24: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   62 |             for(re int i=62;i>=0;--i){
      |                        ^
Main.cpp: In member function ‘void yzqwq::lb::operator+=(yzqwq::lb&)’:
Main.cpp:73:24: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   73 |             for(re int i=62;i>=0;--i)
      |                        ^
Main.cpp: In function ‘yzqwq::lb yzqwq::operator+(lb&, lb&)’:
Main.cpp:79:24: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   79 |             for(re int i=62;i>=0;--i)
      |                        ^
Main.cpp: In member function ‘long long int yzqwq::lb::Max_calc()’:
Main.cpp:85:24: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   85 |             for(re int i=62;i>=0;--i)
      |                        ^
Main.cpp: In function ‘long long int get(std::string)’:
Main.cpp:108:20: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  108 |         for(re int i=0;i<s.size();++i){
      |                    ^
Main.cpp:108:25: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  108 |         for(re int i=0;i<s.size();++i){
      |                        ~^~~~~~~~~
Main.cpp: In function ‘void solve()’:
Main.cpp:129:20: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  129 |         for(re int i=0;i<5;++i) val[i]=rd;
      |                    ^
Main.cpp:132:20: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  132 |         for(re int i=1;i<idx;++i) cout<<a[i].s<<"\n";
      |                    ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 34
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 18 ms 42564 KB
00_sample_01.txt AC 18 ms 42580 KB
00_sample_02.txt AC 18 ms 42664 KB
01_random_03.txt AC 19 ms 42580 KB
01_random_04.txt AC 18 ms 42600 KB
01_random_05.txt AC 19 ms 42660 KB
01_random_06.txt AC 19 ms 42568 KB
01_random_07.txt AC 18 ms 42612 KB
01_random_08.txt AC 19 ms 42592 KB
01_random_09.txt AC 19 ms 42704 KB
01_random_10.txt AC 18 ms 42600 KB
01_random_11.txt AC 18 ms 42632 KB
01_random_12.txt AC 18 ms 42604 KB
01_random_13.txt AC 18 ms 42612 KB
01_random_14.txt AC 19 ms 42504 KB
01_random_15.txt AC 18 ms 42604 KB
01_random_16.txt AC 18 ms 42704 KB
01_random_17.txt AC 18 ms 42500 KB
01_random_18.txt AC 18 ms 42500 KB
01_random_19.txt AC 18 ms 42664 KB
01_random_20.txt AC 18 ms 42608 KB
01_random_21.txt AC 18 ms 42564 KB
01_random_22.txt AC 18 ms 42704 KB
01_random_23.txt AC 19 ms 42596 KB
01_random_24.txt AC 18 ms 42504 KB
01_random_25.txt AC 19 ms 42612 KB
01_random_26.txt AC 19 ms 42500 KB
01_random_27.txt AC 19 ms 42504 KB
01_random_28.txt AC 18 ms 42636 KB
01_random_29.txt AC 18 ms 42580 KB
01_random_30.txt AC 19 ms 42608 KB
01_random_31.txt AC 18 ms 42604 KB
01_random_32.txt AC 17 ms 42636 KB
01_random_33.txt AC 17 ms 42668 KB


2025-03-05 (Wed)
18:08:30 +00:00