QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#790955#5254. Differencesjhinezeal123Compile Error//C++201.7kb2024-11-28 16:11:372024-11-28 16:11:37

Judging History

你现在查看的是最新测评结果

  • [2024-11-28 16:11:37]
  • 评测
  • [2024-11-28 16:11:37]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define ii pair<int, int>
#define iii pair<int,ii>
#define vii vector<ii>
#define fi first
#define se second
#define endl '\n'
#define show(T) {for (auto x:T) cout<<x<<' ';cout<<endl;}
#define all(T) T.begin(),T.end()
using namespace std;
const double eps = 0.0001;
const int mod =/*998244353*/ 1e9+7;
const int N = 1005;
const int MATRIX_SIZE = 64;
const int BLOCK=500;
const long long oo=1e18;
int n,m,k,num[100005][6];
vector <vector<char>> T;
char c;
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
int Rand(int l,int r){
    return abs(rd()*1ll*rd())%(r-l+1)+l;
}
int get(int a,int b){
    int res=0;
    for (int i=1;i<=m;++i)
        res+=(T[a][i]!=T[b][i]);
    return res;
}
bool check(int pos){
    for (int i=1,trol;i<=30;++i){
        do{
            trol=Rand(1,n);
        } while (trol==pos);
        if (get(trol,pos)!=k) return false;
    }
    return true;
}
void solve(){
    cin>>n>>m>>k;
    T.resize(n+5,vector<char>(m+5));
    for (int i=1;i<=n;++i){
        for (int j=1;j<=m;++j){
            // cout<<i<<' '<<j<<endl;
            cin>>c;
            ++num[j][c-'A'];
            T[i][j]=c;
        }
    }
    for (int i=1;i<=n;++i){
        int sum=0;
        for (int j=1;j<=m;++j)
            sum+=num[j][T[i][j]-'A']-1;
        // cout<<i<<' '<<sum<<endl;
        if (sum!=(m-k)*(n-1)) continue;
        if (check(i)) return void(cout<<i);
    }
}
main() {
   // freopen("ok.inp","r",stdin);
    //freopen("kiemtra.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    // cout<<endl<<clock()/1000.0;
}

詳細信息

answer.code: In function ‘long long int Rand(long long int, long long int)’:
answer.code:23:15: error: call of overloaded ‘abs(long long unsigned int)’ is ambiguous
   23 |     return abs(rd()*1ll*rd())%(r-l+1)+l;
      |            ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:42,
                 from answer.code:1:
/usr/include/stdlib.h:840:12: note: candidate: ‘int abs(int)’
  840 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/13/cstdlib:81:
/usr/include/c++/13/bits/std_abs.h:79:3: note: candidate: ‘constexpr long double std::abs(long double)’
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:75:3: note: candidate: ‘constexpr float std::abs(float)’
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:71:3: note: candidate: ‘constexpr double std::abs(double)’
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:61:3: note: candidate: ‘long long int std::abs(long long int)’
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/13/bits/std_abs.h:56:3: note: candidate: ‘long int std::abs(long int)’
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
answer.code: At global scope:
answer.code:60:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   60 | main() {
      | ^~~~