제출 #336744

#제출 시각아이디문제언어결과실행 시간메모리
336744nandonathanielPIN (CEOI10_pin)C++14
100 / 100
664 ms14780 KiB
#include<bits/stdc++.h> using namespace std; map<string,int> mp[16]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); long long ans=0; string s; int n,d; cin >> n >> d; for(int it=1;it<=n;it++){ cin >> s; for(int mask=0;mask<(1<<4);mask++){ if(__builtin_popcount(mask)!=d)continue; string t=""; vector<int> v; bool ya[4]; memset(ya,false,sizeof(ya)); for(int i=0;i<4;i++){ if((1<<i) & mask)v.push_back(i); else ya[i]=true; } for(int i=0;i<(1<<v.size());i++){ for(int j=0;j<v.size();j++){ if((1<<j) & i)ya[v[j]]=true; } int msk=0; string k=""; for(int j=0;j<4;j++){ if(ya[j]){ msk+=(1<<j); k+=s[j]; } } if(__builtin_popcount(i)&1)ans-=mp[msk][k]; else ans+=mp[msk][k]; for(int j=0;j<v.size();j++){ if((1<<j) & i)ya[v[j]]=false; } } } for(int mask=0;mask<(1<<4);mask++){ string t=""; for(int i=0;i<4;i++){ if((1<<i) & mask)t+=s[i]; } mp[mask][t]++; } } cout << ans << '\n'; return 0; }

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

pin.cpp: In function 'int main()':
pin.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int j=0;j<v.size();j++){
      |                 ~^~~~~~~~~
pin.cpp:38:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for(int j=0;j<v.size();j++){
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...