Submission #1088388

# Submission time Handle Problem Language Result Execution time Memory
1088388 2024-09-14T10:18:24 Z whtth Anagramistica (COCI21_anagramistica) C++14
0 / 110
2 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
long long n, k, f[2000010], cnt=0, mod=1e9+7, dp[2010], ans=0;
string S[2010];
unordered_map<string, long long> thutu;
long long modpow(int a, int b){
    int s=a;
    for(int i=1;i<=b;i++){
        a*=s;
        a%=mod;
    }
    return a;
}
int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    freopen("anagramistica.inp", "r", stdin);
    freopen("anagramistica.out", "w", stdout);
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>S[i];
        sort(S[i].begin(), S[i].end());
    }
    for(int i=1;i<=n;i++){
        thutu[S[i]]++;
    }
    for(auto x : thutu){
        f[x.second*(x.second-1)/2]++;
    }
    if(k==0){
        long long ko=modpow(2, f[0]);
        cout<<ko;
    }
    return 0;
}

Compilation message

anagramistica.cpp: In function 'int main()':
anagramistica.cpp:16:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     freopen("anagramistica.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
anagramistica.cpp:17:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     freopen("anagramistica.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -