提出 #1037712
ソースコード 拡げる
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)
#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };
int cheat[60][5];
int ans[40][60];
int correct[40];
int wise[40];
bool cmp(const int & a, const int & b) {
return correct[a] > correct[b];
}
int main() {
for(int i = 0; i < 30; i++)
wise[i] = i;
for(int i = 0; i < 200; i++) {
memset(cheat, 0, sizeof(cheat));
memset(correct, 0, sizeof(correct));
for(int j = 0; j < 30; j++) {
for(int k = 0; k < 50; k++) {
scanf("%d", &ans[j][k]);
cheat[k][ans[j][k]]++;
}
}
for(int j = 0; j < 50; j++) {
int indx = 0;
for(int k = 1; k < 4; k++) {
if(cheat[j][indx] < cheat[j][k])
indx = k;
}
for(int k = 0; k < 30; k++) {
if(ans[k][j] == indx) {
correct[k]++;
}
}
}
memset(cheat, 0, sizeof(cheat));
sort(wise, wise+30, cmp);
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 50; j++) {
cheat[j][ans[wise[i]][j]]++;
}
}
for(int j = 0; j < 50; j++) {
int indx = 0;
for(int k = 1; k < 4; k++) {
if(cheat[j][indx] < cheat[j][k])
indx = k;
}
if(j)
printf(" %d", indx);
else
printf("%d", indx);
}
puts("");
}
return 0;
}
提出情報
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:56:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &ans[j][k]);
^
ジャッジ結果
| セット名 |
All |
| 得点 / 配点 |
100 / 100 |
| 結果 |
|
| セット名 |
テストケース |
| All |
1.txt, 10.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 1.txt |
AC |
27 ms |
256 KiB |
| 10.txt |
AC |
27 ms |
256 KiB |
| 2.txt |
AC |
27 ms |
256 KiB |
| 3.txt |
AC |
27 ms |
256 KiB |
| 4.txt |
AC |
27 ms |
256 KiB |
| 5.txt |
AC |
27 ms |
256 KiB |
| 6.txt |
AC |
27 ms |
256 KiB |
| 7.txt |
AC |
27 ms |
256 KiB |
| 8.txt |
AC |
27 ms |
256 KiB |
| 9.txt |
AC |
27 ms |
256 KiB |