結果
問題 |
No.647 明太子
|
ユーザー |
![]() |
提出日時 | 2018-02-09 22:26:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 37 ms / 4,500 ms |
コード長 | 1,902 bytes |
コンパイル時間 | 1,178 ms |
コンパイル使用メモリ | 111,908 KB |
最終ジャッジ日時 | 2025-01-05 08:11:19 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:60:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 60 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:61:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 61 | rep(i, n) scanf("%d%d",a+i,b+i); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:62:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 62 | scanf("%d", &m); | ~~~~~^~~~~~~~~~ main.cpp:63:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 63 | rep(i, m) scanf("%d%d", x+i, y+i); | ~~~~~^~~~~~~~~~~~~~~~~~
ソースコード
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <iostream> #include <sstream> #include <functional> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <bitset> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <deque> #include <list> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<ll,ll> P; typedef pair<P,ll> PPI; typedef pair<ll,P> PIP; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<P> vp; #define PQ(T) priority_queue<T,vector<T>,greater<T>> #define PQ2(T) priority_queue<T> const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i)) #define rep(i,n) REP(i,0,n) #define rep1(i,n) REP(i,1,n+1) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(x,y) ((x)=min((x),(y))) #define chmax(x,y) ((x)=max((x),(y))) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) #define DEBUG(x) cerr<<"line ("<<__LINE__<<") "<<#x<<": "<<x<<endl; template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;} #define N 20000 int n, m; int a[N], b[N], z[N], y[N], x[N]; int main(){ scanf("%d", &n); rep(i, n) scanf("%d%d",a+i,b+i); scanf("%d", &m); rep(i, m) scanf("%d%d", x+i, y+i); rep(i, n){ rep(j, m) if(x[j]<=a[i]&&y[j]>=b[i]) z[j]++; } int mx = 0; rep(j, m) chmax(mx, z[j]); if(mx==0) cout<<0<<endl; else { rep(j, m) if(z[j]==mx) cout<<j+1<<endl; } return 0; }