Submission details
Task:baka
Sender:Hansuzu
Submission time:2016-08-02 15:39:30 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.05 sdetails
#20.06 sdetails
#30.05 sdetails
#40.06 sdetails
#50.06 sdetails
#60.06 sdetails
#70.06 sdetails
#80.07 sdetails
#90.06 sdetails
#100.06 sdetails
#110.06 sdetails
#120.06 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:58:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0; i<xp.size(); ++i){
                           ^
input/code.cpp:63:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0; i<yp.size(); ++i){
                           ^

Code

#include <iostream>
#include <algorithm>
#include <vector>
#define MP make_pair
#define F first
#define S second
using namespace std;
int N, M;
vector<int> xs;
int mx[1222333];
vector<int> ys;
int my[1222333];
vector<pair<int, int> > xp;
vector<pair<int, int> > yp;
int stx[404040];
int sty[404040];
vector<pair<char, int> > cuts;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> N;
for (int i=0; i<N; ++i){
int x1, y1, x2, y2, x3, y3;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
int xn=min(x1, min(x2, x3));
int xx=max(x1, max(x2, x3));
int yn=min(y1, min(y2, y3));
int yx=max(y1, max(y2, y3));
xp.push_back(MP(xn, xx));
yp.push_back(MP(yn, yx));
xs.push_back(xn);
xs.push_back(xx);
ys.push_back(yn);
ys.push_back(yx);
}
cin >> M;
for (int i=0; i<M; ++i){
char c, t;
int p;
cin >> c >> t >> p;
cuts.push_back(MP(c, p));
if (c=='y') ys.push_back(p);
else xs.push_back(p);
}
sort(xs.begin(), xs.end());
sort(ys.begin(), ys.end());
int ii=0;
for (auto a:xs) mx[a]=ii, ++ii;
ii=0;
for (auto a:ys) my[a]=ii, ++ii;
for (int i=0; i<xp.size(); ++i){
++stx[mx[xp[i].F]+1];
--stx[mx[xp[i].S]];
}
for (int i=1; i<404040; ++i) stx[i]+=stx[i-1];
for (int i=0; i<yp.size(); ++i){
++sty[my[yp[i].F]+1];
--sty[my[yp[i].S]];
}
for (int i=1; i<404040; ++i) sty[i]+=sty[i-1];
for (int i=0; i<M; ++i){
char c=cuts[i].F;
int p=cuts[i].S;
if (c=='y'){
cout << sty[my[p]] << "\n";
}else{
cout << stx[mx[p]] << "\n";
}
}
}

Test details

Test 1

Verdict:

input
WA

correct output
13

user output
(empty)

Test 2

Verdict:

input
UNUCIC

correct output
36

user output
(empty)

Test 3

Verdict:

input
MACDNKIHFGBEHOJ

correct output
74

user output
(empty)

Test 4

Verdict:

input
ABCDEFGHIJKLMNO

correct output
75

user output
(empty)

Test 5

Verdict:

input
NCC

correct output
13

user output
(empty)

Test 6

Verdict:

input
AUUI

correct output
26

user output
(empty)

Test 7

Verdict:

input
UOEAIAOIUE

correct output
56

user output
(empty)

Test 8

Verdict:

input
AOEUIIUEAOEAOIO

correct output
82

user output
(empty)

Test 9

Verdict:

input
CFILOSVZXQCPFZO

correct output
102

user output
(empty)

Test 10

Verdict:

input
BEHKNRUYKRUBNE

correct output
89

user output
(empty)

Test 11

Verdict:

input
ADGJMPTWTPMJGDA

correct output
94

user output
(empty)

Test 12

Verdict:

input
UNUCICA

correct output
39

user output
(empty)