PKU 3435 Sudoku Checker

http://poj.org/problem?id=3435
n*nの穴抜けした数独の盤面が与えられる。
それが数独の条件を満たしているかを判定するというような問題。

縦、横、セルで見て2回以上出現している数があればINCORRECTとした。

int hor[101][101],ver[101][101],cell[101][101];

main(){
  int n;
  cin>>n;
  bool ok=true;
  rep(i,n*n){
    rep(j,n*n){
      int t;
      cin>>t;
      hor[i][t]++;
      if(t && hor[i][t]>1)ok=false;
      ver[j][t]++;
      if(t && ver[j][t]>1)ok=false;
      cell[i/n*n+j/n][t]++;
      if(t && cell[i/n*n+j/n][t]>1)ok=false;
    }
  }
  if(ok)cout<<"CORRECT"<<endl;
  else cout<<"INCORRECT"<<endl;
}