Submission #8418311


Source Code Expand

/*
このコード、と~おれ!
Be accepted!
∧_∧ 
(。・ω・。)つ━☆・*。
⊂   ノ    ・゜+.
 しーJ   °。+ *´¨)
          .· ´¸.·*´¨) ¸.·*¨)
		            (¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define ushi int
#define tapu main
#define nichia (
#define kunn void
#define wara )

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main(){

	int n;
	scanf("%d", &n);
	vector<int> a(n), b(n), c(n);
	rep(i, n)scanf("%d", &a[i]);
	rep(i, n)scanf("%d", &b[i]);
	rep(i, n)scanf("%d", &c[i]);

	sort(all(a));
	sort(all(c));
	ll ans = 0;
	for (auto aa : b) {
		auto ite1 = lower_bound(all(a), aa);
		auto ite2 = upper_bound(all(c), aa);
		int dist1 = distance(a.begin(), ite1), dist2 = distance(ite2, c.end());
		ans += (ll)dist1 * dist2;
	}
	printf("%lld\n", ans);
	Please AC;
}

Submission Info

Submission Time
Task C - Snuke Festival
User null0124
Language C++14 (GCC 5.4.1)
Score 300
Code Size 2832 Byte
Status AC
Exec Time 75 ms
Memory 1408 KB

Compile Error

./Main.cpp: In function ‘void scans(std::string&)’:
./Main.cpp:65:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%c", &c);
                 ^
./Main.cpp:66:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  if (c == '\n')scanf("%c", &c);//最初の改行対策
                               ^
./Main.cpp:69:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%c", &c);
                  ^
./Main.cpp: In function ‘void scanc(char&)’:
./Main.cpp:75:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%c", &c);
                 ^
./Main.cpp:78:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%c...

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 32
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 74 ms 1408 KB
02.txt AC 74 ms 1408 KB
03.txt AC 70 ms 1408 KB
04.txt AC 70 ms 1408 KB
05.txt AC 62 ms 1408 KB
06.txt AC 62 ms 1408 KB
07.txt AC 49 ms 1408 KB
08.txt AC 49 ms 1408 KB
09.txt AC 38 ms 1408 KB
10.txt AC 38 ms 1408 KB
11.txt AC 35 ms 1408 KB
12.txt AC 35 ms 1408 KB
13.txt AC 55 ms 1408 KB
14.txt AC 57 ms 1408 KB
15.txt AC 53 ms 1408 KB
16.txt AC 54 ms 1408 KB
17.txt AC 56 ms 1408 KB
18.txt AC 55 ms 1408 KB
19.txt AC 75 ms 1408 KB
20.txt AC 33 ms 1408 KB
21.txt AC 33 ms 1408 KB
22.txt AC 47 ms 1408 KB
23.txt AC 55 ms 1408 KB
24.txt AC 61 ms 1408 KB
25.txt AC 62 ms 1408 KB
26.txt AC 1 ms 256 KB
27.txt AC 1 ms 256 KB
28.txt AC 1 ms 256 KB
29.txt AC 1 ms 256 KB
s1.txt AC 1 ms 256 KB
s2.txt AC 1 ms 256 KB
s3.txt AC 1 ms 256 KB