| 1 |
#include <iostream> |
| 2 |
|
| 3 |
#include <cstdio> |
| 4 |
|
| 5 |
#include <cmath> |
| 6 |
|
| 7 |
#include <cstdlib> |
| 8 |
|
| 9 |
#include <string> |
| 10 |
|
| 11 |
#include <vector> |
| 12 |
|
| 13 |
#include <stack> |
| 14 |
|
| 15 |
#include <queue> |
| 16 |
|
| 17 |
#include <deque> |
| 18 |
|
| 19 |
#include <algorithm> |
| 20 |
|
| 21 |
#include <typeinfo> |
| 22 |
|
| 23 |
#include <set> |
| 24 |
|
| 25 |
#include <cctype> |
| 26 |
|
| 27 |
#include <locale> |
| 28 |
|
| 29 |
#include <utility> |
| 30 |
|
| 31 |
#include <map> |
| 32 |
|
| 33 |
#include <iterator> |
| 34 |
|
| 35 |
#include <valarray> |
| 36 |
|
| 37 |
#include <complex> |
| 38 |
|
| 39 |
#include <sstream> |
| 40 |
|
| 41 |
#include <bitset> |
| 42 |
|
| 43 |
#include <ctime> |
| 44 |
|
| 45 |
#define all(c) c.begin(),c.end() |
| 46 |
|
| 47 |
#define ifo(n,v) for(int i=v;i<n;++i) |
| 48 |
|
| 49 |
using namespace std; |
| 50 |
|
| 51 |
int in(){ |
| 52 |
|
| 53 |
int a; |
| 54 |
|
| 55 |
scanf("%d",&a); |
| 56 |
|
| 57 |
return a; |
| 58 |
|
| 59 |
} |
| 60 |
|
| 61 |
int ou(int a){ |
| 62 |
|
| 63 |
printf("%d",a); |
| 64 |
|
| 65 |
return 0; |
| 66 |
|
| 67 |
} |
| 68 |
|
| 69 |
int gcd(int a,int b){ |
| 70 |
|
| 71 |
return b?gcd(b,a%b):a; |
| 72 |
|
| 73 |
} |
| 74 |
|
| 75 |
int lcm(int a,int b){ |
| 76 |
|
| 77 |
return agcd(a,b)*b; |
| 78 |
|
| 79 |
} |
| 80 |
|
| 81 |
struct day{ |
| 82 |
|
| 83 |
int a,b,c; |
| 84 |
|
| 85 |
}; |
| 86 |
|
| 87 |
bool myfn(pair <int,int> i, pair <int,int> j) { |
| 88 |
|
| 89 |
if(i.first==j.first) |
| 90 |
|
| 91 |
return i.second<j.second; |
| 92 |
|
| 93 |
else |
| 94 |
|
| 95 |
return i.first<j.first; |
| 96 |
|
| 97 |
} |
| 98 |
|
| 99 |
const int base = 1000*1000*1000; |
| 100 |
|
| 101 |
int main(){ |
| 102 |
|
| 103 |
freopen("in.txt","r",stdin); |
| 104 |
|
| 105 |
freopen("out.txt","w",stdout); |
| 106 |
|
| 107 |
int n=in(),m=in(),buf; |
| 108 |
|
| 109 |
vector <int> mina,maxa; |
| 110 |
|
| 111 |
for(int j=0;j<n;++j){ |
| 112 |
|
| 113 |
int minb=1001; |
| 114 |
|
| 115 |
for(int i=0;i<m;++i){ |
| 116 |
|
| 117 |
scanf("%d",&buf); |
| 118 |
|
| 119 |
minb=min(minb,buf); |
| 120 |
|
| 121 |
if(!j) maxa.push_back(buf); |
| 122 |
|
| 123 |
else{ |
| 124 |
|
| 125 |
maxai=max(maxai,buf); |
| 126 |
|
| 127 |
} |
| 128 |
|
| 129 |
} |
| 130 |
|
| 131 |
mina.push_back(minb); |
| 132 |
|
| 133 |
} |
| 134 |
|
| 135 |
int res=0; |
| 136 |
|
| 137 |
for(int i=0;i<maxa.size();++i){ |
| 138 |
|
| 139 |
for(int j=0;j<mina.size();++j){ |
| 140 |
|
| 141 |
if(maxai==minaj) res++; |
| 142 |
|
| 143 |
cout<<res; |
| 144 |
|
| 145 |
return 0; |
| 146 |
|
| 147 |
valarray <int> a(2),b(2),c(2),d(2),e(2); |
| 148 |
|
| 149 |
d=b-a; |
| 150 |
|
| 151 |
e=c-a; |
| 152 |
|
| 153 |
cout<<"YES"; |
| 154 |
|
| 155 |
return 0; |
| 156 |
|
| 157 |
cout<<"NO"; |
| 158 |
|
| 159 |
deque <int> A; |
| 160 |
|
| 161 |
string a; |
| 162 |
|
| 163 |
getline(cin,a); |
| 164 |
|
| 165 |
int buf; |
| 166 |
|
| 167 |
int b,c; |
| 168 |
|
| 169 |
for(int i=0;i<a.length();++i){ |
| 170 |
|
| 171 |
else{ |
| 172 |
|
| 173 |
b=A.front(); |
| 174 |
|
| 175 |
A.pop_front(); |
| 176 |
|
| 177 |
c=A.front(); |
| 178 |
|
| 179 |
A.pop_front(); |
| 180 |
|
| 181 |
buf=b+c; |
| 182 |
|
| 183 |
A.push_front(buf); |
| 184 |
|
| 185 |
continue; |
| 186 |
|
| 187 |
} |
| 188 |
|
| 189 |
buf=b*c; |
| 190 |
|
| 191 |
A.push_front(buf); |
| 192 |
|
| 193 |
continue; |
| 194 |
|
| 195 |
} |
| 196 |
|
| 197 |
{buf=c-b; |
| 198 |
|
| 199 |
A.push_front(buf); |
| 200 |
|
| 201 |
continue; |
| 202 |
|
| 203 |
} |
| 204 |
|
| 205 |
} |
| 206 |
|
| 207 |
} |
| 208 |
|
| 209 |
cout<<A.front(); |
| 210 |
|
| 211 |
return 0; |
| 212 |
|
| 213 |
map <int, bool> A; |
| 214 |
|
| 215 |
pair <int, bool> b; |
| 216 |
|
| 217 |
int n=in(); |
| 218 |
|
| 219 |
int sum=0; |
| 220 |
|
| 221 |
vector < pair <int,bool> > B; |
| 222 |
|
| 223 |
for(int i=0;i<n;i++){ |
| 224 |
|
| 225 |
b.first=in(); |
| 226 |
|
| 227 |
b.second=0; |
| 228 |
|
| 229 |
sum-=b.first; |
| 230 |
|
| 231 |
B.push_back(b); |
| 232 |
|
| 233 |
b.first=in(); |
| 234 |
|
| 235 |
sum+=b.first; |
| 236 |
|
| 237 |
b.second=1; |
| 238 |
|
| 239 |
B.push_back(b); |
| 240 |
|
| 241 |
} |
| 242 |
|
| 243 |
sort(B.begin(),B.end()); |
| 244 |
|
| 245 |
int res=0,c=0; |
| 246 |
|
| 247 |
for(int i=0; i<B.size(); i++){ |
| 248 |
|
| 249 |
else c--; |
| 250 |
|
| 251 |
} |
| 252 |
|
| 253 |
cout<<res; |
Комментарии