AtCoder Regular Contest 033

Submission #1100469

Source codeソースコード

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  int na, nb;
  scanf("%d %d", &na, &nb);
  set<int> a, common;
  rep (i, na) {
    int tmp;
    scanf("%d", &tmp);
    a.insert(tmp);
  }
  auto universe = a;
  rep (i, nb) {
    int tmp;
    scanf("%d", &tmp);
    universe.insert(tmp);
    if (a.find(tmp) != end(a)) {
      common.insert(tmp);
    }
  }
  printf("%.9f\n", (double)common.size() / (double)universe.size());

  return 0;
}

Submission

Task問題 B - メタ構文変数
User nameユーザ名 cyglef
Created time投稿日時
Language言語 C++11 (GCC 4.8.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 1323 Byte
File nameファイル名
Exec time実行時間 183 ms
Memory usageメモリ使用量 14956 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:40:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &na, &nb);
^
./Main.cpp:44:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &tmp);
^
./Main.cpp:50:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &tmp);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt
Subtask1 40 / 40 sample_01.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt
Subtask2 30 / 30 sample_01.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt
Subtask3 30 / 30 subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask3_01.txt,subtask3_02.txt,subtask3_03.txt,subtask3_04.txt,subtask3_05.txt,subtask3_06.txt,subtask3_07.txt,subtask3_08.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 18 ms 1044 KB
sample_02.txt AC 18 ms 920 KB
subtask1_01.txt AC 17 ms 1044 KB
subtask1_02.txt AC 19 ms 916 KB
subtask1_03.txt AC 20 ms 1044 KB
subtask1_04.txt AC 20 ms 1048 KB
subtask1_05.txt AC 20 ms 1048 KB
subtask1_06.txt AC 18 ms 1176 KB
subtask1_07.txt AC 20 ms 1048 KB
subtask1_08.txt AC 20 ms 1048 KB
subtask1_09.txt AC 19 ms 916 KB
subtask1_10.txt AC 18 ms 1040 KB
subtask2_01.txt AC 73 ms 6188 KB
subtask2_02.txt AC 180 ms 14932 KB
subtask2_03.txt AC 82 ms 7016 KB
subtask2_04.txt AC 180 ms 14956 KB
subtask2_05.txt AC 46 ms 4392 KB
subtask2_06.txt AC 82 ms 7916 KB
subtask2_07.txt AC 138 ms 12332 KB
subtask2_08.txt AC 180 ms 14896 KB
subtask3_01.txt AC 102 ms 9836 KB
subtask3_02.txt AC 160 ms 14884 KB
subtask3_03.txt AC 56 ms 4716 KB
subtask3_04.txt AC 183 ms 14956 KB
subtask3_05.txt AC 90 ms 10284 KB
subtask3_06.txt AC 162 ms 14892 KB
subtask3_07.txt AC 115 ms 12008 KB
subtask3_08.txt AC 176 ms 14892 KB